首页 > 解决方案 > 杀死端口 8081 后 React-native 独立应用程序崩溃

问题描述

我构建了 react-native ios 应用程序的发布版本,但是当我杀死 port 时应用程序崩溃了8081

标签: iosreact-native

解决方案


您必须在构建应用程序之前捆绑资产,

第 1 步:在您的 react native 项目中运行此命令

react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

第 2 步:编辑从调试到发布的构建方案。

第 3 步:替换 appdelegate.m 文件中的代码

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

对此

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

现在您可以构建您的 ios 应用程序的发布版本。

希望这可以帮助 ;-)


推荐阅读