React Native运行iOS上的React Native崩溃

时间:2019-01-06 20:27:09

标签: react-native

我遇到一个问题,即我的本机应用程序先打开然后立即关闭。我运行react-native run-ios,Metro Bundler加载到100%,然后应用崩溃。我到处搜索,无法找到问题所在!

我在模拟器系统日志中找到了这个

Jan  6 20:01:44 Mac-mini MyApp[31448]: assertion failed: 18C54 16B91: libxpc.dylib + 79599 [F7D4B188-D5C2-3E5E-BB76-BC7C6A368166]: 0x7d
Jan  6 20:01:46 Mac-mini com.apple.CoreSimulator.SimDevice.9ABCA7C0-8781-4151-B5C7-ED03FE429BC1[26939] (UIKitApplication:com.myApp.app[0xaf59][26962][31448]): Service exited due to SIGSEGV | sent by exc handler[31448]

尽管构建成功,但我可以看到以下内容,这会引起问题吗?

The following commands produced analyzer issues:
Analyze /Users/maxy/Desktop/myApp/node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
Analyze /Users/maxy/Desktop/myApp/node_modules/react-native/Libraries/Network/RCTNetInfo.m normal x86_64

(2个存在分析器问题的命令)

我尝试删除iOS / build文件。从Xcode清理项目和构建。调试并发布版本。

当我从Xcode运行时,它在输出中显示以下内容:

2019-01-06 20:08:57.083678+0000 myApp[31468:269858]  - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2019-01-06 20:08:57.198519+0000 myApp[31468:269858] 5.15.0 - [Firebase/Analytics][I-ACS023007] Analytics v.50400000 started
2019-01-06 20:08:57.200271+0000 myApp[31468:269858] 5.15.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2019-01-06 20:08:57.225194+0000 myApp[31468:269858] 5.15.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
2019-01-06 20:08:57.252 [info][tid:main][RCTCxxBridge.mm:216] Initializing <RCTCxxBridge: 0x600002578ff0> (parent: <RCTBridge: 0x600003168620>, executor: (null))
2019-01-06 20:08:57.254831+0000 myApp[31468:269808] Initializing <RCTCxxBridge: 0x600002578ff0> (parent: <RCTBridge: 0x600003168620>, executor: (null))
2019-01-06 20:08:57.447 [info][tid:main][RCTRootView.m:293] Running application myApp ({
initialProps =     {
};
rootTag = 1;
})
2019-01-06 20:08:57.447252+0000 myApp[31468:269808] Running application myApp ({
initialProps =     {
};
rootTag = 1;
})
2019-01-06 20:08:57.480500+0000 myApp[31468:269808] -[RNFirebaseMessaging init] [Line 34] Setting up RNFirebaseMessaging instance
2019-01-06 20:08:57.480835+0000 myApp[31468:269808] -[RNFirebaseAuth init]_block_invoke [Line 42] RNFirebaseAuth:instance-created
2019-01-06 20:08:57.480973+0000 myApp[31468:269808] -[RNFirebaseAuth init] [Line 45] RNFirebaseAuth:instance-initialized
2019-01-06 20:08:57.481224+0000 myApp[31468:269808] -[RNFirebase init] [Line 12] Setting up RNFirebase instance
2019-01-06 20:08:57.481635+0000 myApp[31468:269808] -[RNFirebaseNotifications init] [Line 45] Setting up RNFirebaseNotifications instance
2019-01-06 20:08:57.496791+0000 myApp[31468:269808] -[RNFirebaseMessaging messaging:didReceiveRegistrationToken:] [Line 87] Received new FCM token: fXHq98QGnyw:APA91bH7b66ywMfcEVB6yPSUG_p1pkFugA4PY1EtmkJaG_43JtNkPnAG-MPJ6cP2RsknEWwGqUqzfIhOCfocWM_NSQfAQVhTY1JRTwenzn-tczYhUK90d4P7nynu1xAD81kur39mVG2E
2019-01-06 20:08:57.528077+0000 myApp[31468:269869] [] nw_socket_handle_socket_event [C5.1:1] Socket SO_ERROR [61: Connection refused]
2019-01-06 20:08:57.547389+0000 myApp[31468:269869] [] nw_socket_handle_socket_event [C5.2:1] Socket SO_ERROR [61: Connection refused]
2019-01-06 20:08:57.549096+0000 myApp[31468:269887] [] nw_connection_get_connected_socket [C5] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-01-06 20:08:57.626521+0000 myApp[31468:269877] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fc74e606a40] get output frames failed, state 8196
2019-01-06 20:08:57.626723+0000 myApp[31468:269877] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fc74e606a40] get output frames failed, state 8196
2019-01-06 20:08:57.627564+0000 myApp[31468:269877] TIC Read Status [1:0x0]: 1:57
2019-01-06 20:08:57.627978+0000 myApp[31468:269877] TIC Read Status [1:0x0]: 1:57

还有什么我可以检查的/更多的日志吗? 当我执行本机运行Android时,一切正常。

谢谢。

1 个答案:

答案 0 :(得分:1)

1:如果已安装pod,请确保检查所有库。安装的外部库可能有问题。 并确保您运行pod install并删除node_modules文件夹,然后再次运行npm install(也关闭打包程序)

2:您还可以使用sentry或任何其他崩溃报告库来检测崩溃,它将为您提供确切的行号。(请确保安装了react-native版本)。

3:有时崩溃报告库不起作用,原因可能是崩溃发生在加载js bundle之前,因此,该库尚未初始化并且无法检测到崩溃。如果是这样,您可以安装本机崩溃报告库,则可以使用fabric甚至是bugsnag

4:即使这3个步骤不起作用,有时也会由于证书中的某些问题而使应用程序在启动时崩溃,有时应用程序可以工作几天,然后突然崩溃,如果发生这种情况。确保您的证书正确生成。

这些是发生这种崩溃的几种情况。通常是第一个