gpt4 book ai didi

ios - 升级以响应 native 0.59.10 后无法加载包 (ios)

转载 作者:行者123 更新时间:2023-11-29 13:53:43 25 4
gpt4 key购买 nike

当我将我的项目从 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

它显示了这个错误 enter image description here

这是我的IP地址

enter image description here

我错过了什么吗?任何人都可以帮助我吗?谢谢!

最佳答案

通过以下步骤解决:

  1. rm -rf ios/build/
  2. 杀死 $(lsof -t -i:8081)
  3. react-native run-ios

关于ios - 升级以响应 native 0.59.10 后无法加载包 (ios),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58109504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com