Не удалось загрузить пакет (IOS) после обновления, чтобы реагировать на нативный 0.59.10 - PullRequest
1 голос
/ 26 сентября 2019

При обновлении проекта с 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

А вот и AppDelegate.m после обновления до 0.59.10

#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 Ответ

0 голосов
/ 27 сентября 2019

Решается с помощью этих шагов:

  1. rm -rf ios / build /
  2. kill $ (lsof -t -i: 8081)
  3. реагировать-нативныйrun-ios
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...