ios - 反应原生 iOS 未从 xcode 连接到打包程序
问题描述
我有一个 react native (0.55.4) 项目,它在 Android 或 iOS 模拟器上运行良好。但是当我从 Xcode (9.3) 运行它时,应用程序在设备上启动,显示启动画面,metro bundler 在 mac 上启动,但是应用程序没有连接到 bundler/packager。
没有显示捆绑 js 代码的进程(绿色条)。
我还在 xcode 输出中获取这些日志:
2018-05-18 17:00:46.613995+0530 Thunderpod[42517:6526595] NSURLConnection finished with error - code -1001
2018-05-18 17:00:46.637 [info][tid:main][RCTCxxBridge.mm:210] Initializing <RCTCxxBridge: 0x1c01c3480> (parent: <RCTBridge: 0x1c00c6270>, executor: (null))
2018-05-18 17:00:46.633051+0530 Thunderpod[42517:6526595] Task <CE0CD57D-C025-4768-91D1-C9A03F02C072>.<0> HTTP load failed (error code: -999 [1:89])
2018-05-18 17:00:46.645156+0530 Thunderpod[42517:6526510] Initializing <RCTCxxBridge: 0x1c01c3480> (parent: <RCTBridge: 0x1c00c6270>, executor: (null))
2018-05-18 17:00:46.689 [warn][tid:main][RCTBridge.m:119] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2018-05-18 17:00:46.689056+0530 Thunderpod[42517:6526510] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
在这些之后,我的应用程序(名为:Thunderpod)的日志正在显示:
2018-05-18 17:00:46.771 [info][tid:main][RCTRootView.m:293] Running application Thunderpod ({
initialProps = {
};
rootTag = 1;
})
2018-05-18 17:00:46.770981+0530 Thunderpod[42517:6526510] Running application Thunderpod ({
initialProps = {
};
rootTag = 1;
})
2018-05-18 17:00:47.377 [info][tid:com.facebook.react.JavaScript] Running application "Thunderpod" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2018-05-18 17:00:47.376715+0530 Thunderpod[42517:6527004] Running application "Thunderpod" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2018-05-18 17:00:47.395 [warn][tid:com.facebook.react.JavaScript] Persistor added to window variable
2018-05-18 17:00:47.394879+0530 Thunderpod[42517:6527004] Persistor added to window variable
2018-05-18 17:00:47.407 [info][tid:com.facebook.react.JavaScript] On before lift
2018-05-18 17:00:47.406652+0530 Thunderpod[42517:6527004] On before lift
2018-05-18 17:00:47.409 [info][tid:com.facebook.react.JavaScript] 'Persistor restored:', { rootReducer: { isFirstTime: true },
userDataReducer:
{ userRegistrationType: 'none',
userCountryData: { name: '-', callingCode: '-', countryCode: '-' },
userMobileNumber: '',
userFacebookData: {},
userPhoneData: {} },
_persist: { version: -1, rehydrated: true } }
2018-05-18 17:00:47.408920+0530 Thunderpod[42517:6527004] 'Persistor restored:', { rootReducer: { isFirstTime: true },
userDataReducer:
{ userRegistrationType: 'none',
userCountryData: { name: '-', callingCode: '-', countryCode: '-' },
userMobileNumber: '',
userFacebookData: {},
userPhoneData: {} },
_persist: { version: -1, rehydrated: true } }
2018-05-18 17:00:47.412 [info][tid:com.facebook.react.JavaScript] [App] Render
2018-05-18 17:00:47.412247+0530 Thunderpod[42517:6527004] [App] Render
2018-05-18 17:00:47.509556+0530 Thunderpod[42517:6526510] refreshPreferences: HangTracerEnabled: 0
2018-05-18 17:00:47.509604+0530 Thunderpod[42517:6526510] refreshPreferences: HangTracerDuration: 500
2018-05-18 17:00:47.509622+0530 Thunderpod[42517:6526510] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
2018-05-18 17:00:47.717 [info][tid:com.facebook.react.JavaScript] Component did mount.. Checking user authentication..
2018-05-18 17:00:47.717345+0530 Thunderpod[42517:6527004] Component did mount.. Checking user authentication..
2018-05-18 17:00:47.801047+0530 Thunderpod[42517:6527003] [] nw_connection_get_connected_socket 2 Connection has no connected handler
2018-05-18 17:00:47.801124+0530 Thunderpod[42517:6527003] TCP Conn 0x1c416f780 Failed : error 0:61 [61]
2018-05-18 17:00:47.916899+0530 Thunderpod[42517:6527008] [] nw_connection_get_connected_socket 3 Connection has no connected handler
2018-05-18 17:00:47.916938+0530 Thunderpod[42517:6527008] TCP Conn 0x1c416dec0 Failed : error 0:61 [61]
2018-05-18 17:00:48.075 [warn][tid:com.facebook.react.JavaScript] Warning: isMounted(...) is deprecated in plain JavaScript React classes. Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.
2018-05-18 17:00:48.074829+0530 Thunderpod[42517:6527004] Warning: isMounted(...) is deprecated in plain JavaScript React classes. Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.
20
另请注意,日志正在重复!
我的设置有什么问题?
编辑:我创建了一个新项目,没有做任何更改,我使用 xcode 运行它,它给了我同样的问题!
这是 package.json,我的 XCode 版本是 9.3 (9E145),直到昨天都运行良好:
{
"name": "TestXcode",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
解决方案
转到模拟器 --> 设备 --> 摇动 --> 配置捆绑包 --> 127.0.0.1:8081
推荐阅读
- ios - 在 UITableView Swift 4 的主要滑动操作中不显示标题
- python - 没有获得 YOLO v3 模型的边界框
- batch-file - 如何将空标记保留在for循环中
- javascript - 使用计时器处理连续的承诺
- android - Android PWA - 如何防止在应用程序之间切换后重新加载?
- python - 在 spacy 的帮助下合并几乎相似的行
- c# - 在表达式中模拟动态属性,用于 Bogus
- apache-kafka - 是否指定了 Kafka Streams 拓扑的处理顺序?
- docker - bitbake 错误:PermissionError:[Errno 1] 不允许操作:更改文件系统上的所有者组时
- python - 使用订阅后如何从df表中获取pandas的价值