React Native App 在设备的启动屏幕上崩溃 [英] React Native App crashes on Launch Screen on device
问题描述
我从 React Native 开始,在 iOS 模拟器中一切正常.我决定在设备上试一试.
I'm starting with React Native, everything works fine in the iOS simulator. I decide to try it on a device.
应用程序启动,我可以玩它,我关闭/重新打开它大约 4 或 5 次,然后应用程序在启动屏幕上随机崩溃(带有Powered By React Native"的那个).它只是显示屏幕,然后应用程序崩溃到 iPhone 主屏幕.
The app launches, I can play with it, I close/reopen it around 4 or 5 times, and then somewhat randomly the app crashes on Launch Screen (the one with "Powered By React Native"). It just shows the screen, and the app crashes to the iPhone home screen.
知道如何进一步调试吗?
Any idea how I can further debug that?
我在 AppDelegate.m 中添加了 Bugsnag,但当应用崩溃时,Bugsnag 没有检测到任何内容.
I added Bugsnag in my AppDelegate.m, but bugsnag doesn't detect anything when the app crashes.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
[BugsnagReactNative start];
// Rest of code
}
推荐答案
我今天遇到了这个问题.阅读一些 SO 帖子,看到一个人提到如果您的应用程序启动并挂在启动屏幕上,然后崩溃而没有错误,它可能与您的 npm 依赖项之一有关.
I came across this issue today. Read a few SO posts and saw one guy mentioned if your app launches and hangs on the splash screen and then crashes with no error it probably has something to one of your npm dependencies.
深入挖掘后,我看到 react 打包程序抛出错误
After digging deeper i saw the react packager was throwing the error
此错误是由跨两个不同文件的同名@providesModule 声明引起的.
修复
检查/清理依赖项(检查同名声明)
check / clean up dependencies(check for same name declerations)
rm -rf node_modules
rm -rf $TMPDIR/react-*
npm i
这篇关于React Native App 在设备的启动屏幕上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!