将项目从0.55.4升级到0.59.10时遇到一些问题。它可以成功构建,但是之后我显示节点服务器错误。
这是升级前的我的AppDelegate.m。没关系。该应用程序运行正常。
#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
这是升级到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
这是我的IP地址
我想念什么吗?有人可以帮助我吗?谢谢!
答案 0 :(得分:0)
通过以下步骤解决: