ios - react native iOS未从xcode连接到打包程序

标签 ios xcode react-native

我有一个React Native(0.55.4)项目,它在Android或iOS模拟器上工作正常。但是,当我从Xcode(9.3)运行它时,应用程序在设备上启动,显示启动屏幕,地铁捆绑程序在mac上启动,但应用程序未连接到捆绑程序/打包程序。

没有显示捆绑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"
  }
}

最佳答案

如果使用物理iOS设备,请确保Macbook和设备位于同一wifi网络上,并已通过USB电缆插入。
See docs for more info

关于ios - react native iOS未从xcode连接到打包程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50410560/

相关文章:

android - 如何在 react 导航中隐藏工具栏

javascript - 当 React Native(android) 中的 Multiline={true} 时,onSubmitEditing 不适用于 TextInput

ios - UIPageViewController 中 WebView 的滚动问题

iphone - 在 iOS 6 上的 UIWebView 中全屏播放 YouTube 视频

ios - 如何调整 iphone 应用程序的 xib View 以适应 xcode 中的 ipad

ios - 通用 API 请求处理程序

swift - 如何在swift中获取数组的元素类型

ios - 单击 TableView 中的按钮时从其他 View Controller 重新加载 UITableView

ios - TableView 中的 cellForRowAt 未更新

javascript - ScrollView 不会在 android 上滚动