gpt4 book ai didi

javascript - React Native IOS 生产版本 : RCTFatalException crash and SocketProtocolError YellowBox

转载 作者:行者123 更新时间:2023-12-01 16:09:06 26 4
gpt4 key购买 nike

我有一个 react-native 应用程序(目前仅适用于 iOS)——并且来自 JS 背景并且不熟悉 XCode,我发现有关为 iOS 创建生产构建的文档非常稀少。根据 https://facebook.github.io/react-native/docs/running-on-device-ios.html 上的一个模糊句子:
The JS bundle will be built for dev or prod depending on your app's scheme (Debug = development build with warnings, Release = minified prod build with perf optimizations). To change the scheme navigate to Product > Scheme > Edit Scheme... in xcode and change Build Configuration between Debug and Release.

但是,在 XCode v7.3 中,当我单击“产品”>“方案”>“编辑方案”时看到的内容(没有“在调试和发布之间更改构建配置”的选项):

Product > Scheme > Edit Scheme

我了解如何在本地手机上运行,​​以及在模拟器上运行与手机上运行的区别。它在模拟器和插入的手机上运行良好。

现在,当我归档应用程序、保存以进行临时分发、上传到 TestFairy、在手机上下载并运行它时 - 我经常看到类似 Yellowbox 警告的内容:

YellowBox

还有像这样的可疑崩溃(由TestFairy记录):

Application Specific Information:
*** Terminating app due to uncaught exception 'RCTFatalException: Could not connect to development server.

Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate

URL: http://192.168.0.21:8081/index.ios.bundle?platform=ios', reason: 'Could not connect to development server.

Ensure the following:
- Node serv...'

Last Exception Backtrace:
0 CoreFoundation 0x22939b8b __exceptionPreprocess (in CoreFoundation) + 127
1 libobjc.A.dylib 0x220f6dff objc_exception_throw (in libobjc.A.dylib) + 39
2 CoreFoundation 0x22939ad1 -[NSException initWithCoder:] (in CoreFoundation) + 1
3 myapp 0x000b1ad5 0x98000 + 105173
4 myapp 0x000cb01f 0x98000 + 208927
5 myapp 0x000c9149 0x98000 + 201033
6 libdispatch.dylib 0x224cbcbf _dispatch_call_block_and_release (in libdispatch.dylib) + 11
7 libdispatch.dylib 0x224cbcab _dispatch_client_callout (in libdispatch.dylib) + 23
8 libdispatch.dylib 0x224d0559 _dispatch_main_queue_callback_4CF (in libdispatch.dylib) + 1533
9 CoreFoundation 0x228fb7d5 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) + 9
10 CoreFoundation 0x228f9ccf __CFRunLoopRun (in CoreFoundation) + 1591
11 CoreFoundation 0x22848289 CFRunLoopRunSpecific (in CoreFoundation) + 517
12 CoreFoundation 0x2284807d CFRunLoopRunInMode (in CoreFoundation) + 109
13 GraphicsServices 0x23e64af9 GSEventRunModal (in GraphicsServices) + 161
14 UIKit 0x26f732c5 UIApplicationMain (in UIKit) + 145
15 myapp 0x0009d4e7 0x98000 + 21735
16 libdyld.dylib 0x224f4873 start (in libdyld.dylib) + 3

那么,在 XCode 中创建用于分发的 react native 生产构建的正确步骤是什么?

最佳答案

更新

我找到了这个问题的赞成答案 How to build .IPA for React Native?解决问题 .由于该帖子上的问题与我的问题无关,因此我将保留它,但它通过使用命令行解决了创建生产构建的问题:
react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios

并且在 AppDelegate.m 中取消注释这一行:
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

关于javascript - React Native IOS 生产版本 : RCTFatalException crash and SocketProtocolError YellowBox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36994376/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com