2017-04-16 9 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

관련 문제