해결된 질문
작성
·
1.1K
0
답변 1
0
시뮬레이터 사파리에서 192.168.1.78:3105 로 접속하면 정상적으로 화면 뜨시나요? 안 뜬다면 localhost:3105로도 해보세요.
그리고 소스코드에서 Alert에서 email, name, password 전부 다 정상적으로 뜬 뒤에 catch 쪽에 Alert가 뜨는 건가요?
이상하네요 아래와 같이 세팅했는데
console.log("log",Config.API_URL); -> undefined라고 뜹니다.
이렇게 설정되어 있는데 위치가 잘못된걸까요? 실기기에서 하다가 하도 안되서 시뮬레이터 띄우고 localhost로 해도 똑같이 뜨네요...ㅠㅠ 역시나 Config안쓰고 강제로 하드코딩해서 url을 넣으니 잘 작동하네요. 내일은 왜 정상작동안하는지 꼼꼼히 살펴봐야 할듯 합니다.
좀 찾아봤는데 Podfile에
pod 'react-native-config', :path => '../node_modules/react-native-config/react-native-config.podspec'
넣고 pod install(또는 npx pod-install) 해서 재설치해보라고 하는 것 같습니다.
와우 고맙습니다. 잘됩니다. 근데 프로젝트할때 이렇게 설치가 안된 모듈을 어떻게 찾을수 있을까요?
import할때 에러도 없고 혹시 방법 알고 계시면 말씀좀 부탁드립니다.
2022-08-22 14:29:18.205576+0900 FoodDeliveryApp[91055:2266755] [javascript] Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.[[46,46,48,26,23],[0,1,1,0,5],[[231,2000,1661146158155,false],[231],["{\"type\":\"log\",\"level\":\"log\",\"mode\":\"BRIDGE\",\"data\":[\"[AxiosError: Network Error]\"]}",1],[865,"RCTRawText",1,{"text":"회원가입"}]],978]
This error is located at:
in RCTText (at Text.js:184)
in Text (at SignUp.tsx:142)
in RCTView (at View.js:32)
in View (at SignUp.tsx:123)
in RCTScrollContentView (at ScrollView.js:1682)
in RCTScrollView (at ScrollView.js:1800)
in ScrollView (at ScrollView.js:1826)
in ScrollView (at KeyboardAwareScrollView.js:14)
in KeyboardAwareScrollView (at DismissKeyboardView.tsx:18)
in TouchableWithoutFeedback (at DismissKeyboardView.tsx:17)
in DismissKeyboardView (at SignUp.tsx:90)
in SignUp (at SceneView.tsx:132)
in StaticContainer
in EnsureSingleNavigator (at SceneView.tsx:124)
in SceneView (at useDescriptors.tsx:217)
in RCTView (at View.js:32)
in View (at DebugContainer.native.tsx:27)
in DebugContainer (at NativeStackView.native.tsx:76)
in MaybeNestedStack (at NativeStackView.native.tsx:288)
in RNSScreen (at createAnimatedComponent.js:211)
in AnimatedComponent (at createAnimatedComponent.js:264)
in AnimatedComponentWrapper (at src/index.native.tsx:257)
in MaybeFreeze (at src/index.native.tsx:256)
in Screen (at NativeStackView.native.tsx:214)
in SceneView (at NativeStackView.native.tsx:342)
in RNSScreenStack (at src/index.native.tsx:188)
in ScreenStack (at NativeStackView.native.tsx:331)
in NativeStackViewInner (at NativeStackView.native.tsx:388)
in RNCSafeAreaProvider (at SafeAreaContext.tsx:87)
in SafeAreaProvider (at SafeAreaProviderCompat.tsx:46)
in SafeAreaProviderCompat (at NativeStackView.native.tsx:387)
in NativeStackView (at createNativeStackNavigator.tsx:72)
in Unknown (at createNativeStackNavigator.tsx:71)
in NativeStackNavigator (at AppInner.tsx:46)
in EnsureSingleNavigator (at BaseNavigationContainer.tsx:430)
in BaseNavigationContainer (at NavigationContainer.tsx:132)
in ThemeProvider (at NavigationContainer.tsx:131)
in NavigationContainerInner (at AppInner.tsx:26)
in AppInner (at App.tsx:27)
in Provider (at App.tsx:26)
in App (at renderApplication.js:50)
in RCTView (at View.js:32)
in View (at AppContainer.js:92)
in RCTView (at View.js:32)
in View (at AppContainer.js:119)
in AppContainer (at renderApplication.js:43)
in FoodDeliveryApp(RootComponent) (at renderApplication.js:60)
2022-08-22 14:29:18.313214+0900 FoodDeliveryApp[91055:2266521] [native] Running surface LogBox ({
initialProps = {
};
rootTag = 21;
})
2022-08-22 14:29:20.250838+0900 FoodDeliveryApp[91055:2266755] [javascript] Possible Unhandled Promise Rejection (id: 1):
Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
[[46,46,48,26,23],[0,1,1,0,5],[[231,2000,1661146158155,false],[231],["{\"type\":\"log\",\"level\":\"log\",\"mode\":\"BRIDGE\",\"data\":[\"[AxiosError: Network Error]\"]}",1],[865,"RCTRawText",1,{"text":"회원가입"}]],978]
@[native code]
enqueueNativeCall@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:2975:43
nonPromiseMethodWrapper@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:2609:78
createView@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:55345:42
createTextInstance@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:7001:57
completeWork@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:13307:64
completeUnitOfWork@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:18032:34
performUnitOfWork@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:18009:29
workLoopSync@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:17938:28
renderRootSync@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:17916:25
performSyncWorkOnRoot@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:17661:40
performSyncWorkOnRoot@[native code]
flushSyncCallbacks@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:7634:36
flushSyncCallbacksOnlyInLegacyMode@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:7615:29
scheduleUpdateOnFiber@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:17245:47
dispatchSetState@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:11614:43
dispatchSetState@[native code]
@http://192.168.1.78:8081/src/pages/SignUp.bundle?platform=ios&modulesOnly=true&app=kr.co.touchtop&dev=true&minify=false&runModule=true&shallow=true:114:19
generatorResume@[native code]
asyncGeneratorStep@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:24430:26
_throw@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:24456:29
tryCallOne@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:28646:16
@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:28747:27
@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:29911:26
_callTimer@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:29811:17
_callReactNativeMicrotasksPass@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:29846:17
callReactNativeMicrotasks@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:30054:44
__callReactNativeMicrotasks@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:3033:46
@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:2811:45
__guard@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:3016:15
flushedQueue@http://192.168.1.78:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=kr.co.touchtop:2810:21
flushedQueue@[native code]
callFunctionReturnFlushedQueue@[native code]
2022-08-22 14:29:22.659426+0900 FoodDeliveryApp[91055:2266521] [EventDispatcher] Found no UIEvent for backing event of type: 11; contextId: 0x209D010E; Event will not be dispatched
2022-08-22 14:29:22.659774+0900 FoodDeliveryApp[91055:2266521] [EventDispatcher] Found no UIEvent for backing event of type: 11; contextId: 0x209D010E; Event will not be dispatched
소스코드는 아래와 같습니다.
try{
setLoading(true);
Alert.alert("email",email);
Alert.alert("name",name);
Alert.alert("password",password);
//await은 비동기라는걸 표시해 주는것임 promise
//http method : get put patch post delete head options
const response = await axios.post(`${Config.API_URL}/user`,{email,name,password});
console.log(response);
Alert.alert('알림', '회원가입 되었습니다.');
//tsc 4.4부터 변경됨.
}catch(e:any){
console.log(e);
Alert.alert('알림', e);
} finally{
setLoading(false);
}
참고 로 현재 IOS에서 빌드하고 있습니다.
그리고 http기반이라 Allow Arbitrary Loads은 YES로 추가해 놓은 상태입니다.
뭐가 문제인지 알수가 없어서 문의 드립니다.