我正在使用react-native app。 以前我的应用程序是0.25.0版本,但现在我已经升级了我的应用程序的本机版本。
现在我的应用程序未在iOS设备上运行。 它表现得像 如果没有实现loadSourceForBridge'' bundleURL必须是非零的。
我的AppDelegate.m文件如下所示:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
NSLog(@"JSCodelocationh=%@",jsCodeLocation);
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Roger"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
在此我的jsCodeLocation返回null值。 谁能告诉我如何解决这个问题。
答案 0 :(得分:0)
一些反应原生版本升级需要手动步骤。 Read official docs和check with rn-diff。
答案 1 :(得分:0)
我有类似的问题。
在-lc++
中添加Other Linker Flags
有帮助。
我还更新了AppDelegate中的代码,不使用jsBundleURLForBundleRoot(它在示例项目中用于react-native-navigation)
检查一下:(npm 3有同样的问题) https://github.com/wix/react-native-navigation/issues/1
答案 2 :(得分:0)
感谢您帮助我解决我的问题。 我发现解决方案我有一些我在控制台中看不到的内部错误,因此我的main.jsbundle没有正确创建。清除所有错误后,我的main.jsbundle被正确创建,现在正在获取我的jscodelocation。