[英]Failed to load bundle (ios) after upgrading to react native 0.59.10
I'm getting some issues when I upgrade my project from 0.55.4 to 0.59.10.当我将项目从 0.55.4 升级到 0.59.10 时,我遇到了一些问题。 It can be built successfully but after that I shows node server error.它可以成功构建,但之后我显示节点服务器错误。
Here is my AppDelegate.m before upgrading.这是我升级前的 AppDelegate.m。 It's okay.没关系。 The app run as I expected.该应用程序按我的预期运行。
#import ...
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//some codes here...
NSURL *jsCodeLocation;
#ifdef DEBUG
NSString *url = @"http://localhost";
url = @"http://192.168.2.125";
NSString *urlBody = @":8081/index.bundle?platform=ios&dev=true";
NSString *urlFull = [NSString stringWithFormat:@"%@%@",url, urlBody];
jsCodeLocation = [NSURL URLWithString:urlFull];
#else
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#endif
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Cloud9"
initialProperties:nil
launchOptions:launchOptions];
//some codes here...
}
//some codes here...
@end
And here is the AppDelegate.m after upgrading to 0.59.10这是升级到 0.59.10 后的 AppDelegate.m
#import ...
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//some codes here...
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Cloud9"
initialProperties:nil
launchOptions:launchOptions];
//some codes here...
}
//some codes here...
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
NSString *url = @"http://localhost";
url = @"http://192.168.2.125";
NSString *urlBody = @":8081/index.bundle?platform=ios&dev=true";
NSString *urlFull = [NSString stringWithFormat:@"%@%@",url, urlBody];
return [NSURL URLWithString:urlFull];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
And this is my ip address这是我的 ip 地址
Am I missing something?我错过了什么吗? Anyone can help me?任何人都可以帮助我吗? Thanks!谢谢!
Solved by these steps:通过以下步骤解决:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.