Open ios/YourApp/AppDelegate.m Uncomment the line, jsCodeLocation = [[NSBundle mainBundle] ...
However, with the latest version of
react-native 0.30.0
, this line is no longer present in the default AppDelegate.m
file. Here is an excerpt from the default AppDelegate.m
file."NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"TestAppDelete"
initialProperties:nil
launchOptions:launchOptions];
如果我尝试像以前的版本那样使用
jsCodeLocation
,它将返回null。jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
我不确定为什么
main.jsbundle
的URL返回为null
。它是否不再由打包器创建。如果应该使用最新版本创建,如何确认?如果您已经在iOS设备上使用离线捆绑运行了
react-native 0.30.0
应用程序,请分享如何操作的说明。
AppDelegate
文件,在react-native
升级后我只是替换它,而且文档也没有更新,这使情况更加混乱。请注意 - 如果我在没有将“Build Configuration”更改为“Release”的情况下在设备上运行应用程序,只要它连接到Mac,我就能够运行该应用程序。如果我停止应用程序,断开电话并尝试再次运行它,则无法启动。在这种情况下,设置“Build Configuration”为“Release”有助于解决问题。再次感谢! - Varun Gupta