2017-04-16 52 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模式

它確實聲明部署時取消註釋下面的代碼。

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

要轉到

產品>模式>編輯模式>更改生成配置release

此測試這個模擬器上,將模式改爲release基本上是檔案的功能。

enter image description here

相關問題