2017-04-16 5 views
0

私はReact Nativeプロジェクトを完了した後、AppHubでクイックスタートをやっています。これらの行をコメントアウトしようとすると、No bundle URL presentというエラーが発生します。React NativeとAppHub:バンドルURLがありません

AHBuild *build = [[AppHub buildManager] currentBuild]; 
    jsCodeLocation = [build.bundle URLForResource:@"main" 
            withExtension:@"jsbundle"]; 

どうすればこの問題を解決できますか?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    [AppHub setApplicationID:@"25QLeX4o6N8Xm0naFxnx"]; 

    NSURL *jsCodeLocation; 

    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 

    /** 
    * OPTION 3 - AppHub 
    * 
    * Load cached code and images from AppHub. 
    * 
    */ 

    AHBuild *build = [[AppHub buildManager] currentBuild]; 
    jsCodeLocation = [build.bundle URLForResource:@"main" 
            withExtension:@"jsbundle"]; 

    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 
                 moduleName:@"Hang" 
               initialProperties:nil 
                launchOptions:launchOptions]; 
    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 
    UIViewController *rootViewController = [UIViewController new]; 
    rootViewController.view = rootView; 
    self.window.rootViewController = rootViewController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

答えて

0

この点に関しては、ドキュメントはかなり貧弱であり、コードはより有益です。アプリケーションをアーカイブすると、コードは正常に動作しません。debugモード

デプロイ時に次のコードのコメントを外すように指定しています。 release

これに

製品>スキーマ>編集スキーマ>変更ビルド構成に行くことによってreleaseにスキーマを変更シミュレータ上でこれをテストするには

AHBuild *build = [[AppHub buildManager] currentBuild]; 
    jsCodeLocation = [build.bundle URLForResource:@"main" 
            withExtension:@"jsbundle"]; 

基本的にアーカイブが行うことです。

enter image description here

関連する問題