2016-07-20 62 views
1

我跑在我的iPhone做出反應,原生應用陣營本地遠程調試器,應用程序似乎加載罰款,但是當我搖晃,使遠程調試JS我得到這個錯誤:不工作的iPhone

enter image description here

我試過以下React-Native的文檔https://facebook.github.io/react-native/docs/running-on-device-ios.html但是看起來已經過時了。

AppDelegate.m

#import "AppDelegate.h" 
#import "RCTBundleURLProvider.h" 
#import "RCTRootView.h" 

@implementation AppDelegate 

- (BOOL)application:(UIApplication *)application  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    NSURL *jsCodeLocation; 

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


    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 
                 moduleName:@"abcrn123" 
              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; 
} 

@end 

任何幫助將不勝感激,我試圖運行和實際設備上調試陣營原生應用程序。

謝謝,道格。

回答

1

有時超時。我通常會用這個步驟。 1.搖動,然後停止遠程調試。 2.讓它運行。 3.再次搖動並重新開始遠程調試。 4.應重新加載。你應該很好去。

這很煩人我知道...

1

我今天通過這一點戰鬥。下面是一個使用React Native Debugger流:

  1. 清除所有緩存,以重新開始通過:watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean -force && npm install,按:https://gist.github.com/jarretmoses/c2e4786fd342b3444f3bc6beff32098d
  2. $ REACT_DEBUGGER="open -g 'rndebugger://set-debugger-loc?port=8001' ||" react-native start
    (現在打包運行 - 切換的終端窗口)
  3. $ react-native run-ios --device "iPad" (或任何你的設備被命名爲)
  4. 記下在ipad上列出的ip地址或其他在加載時在綠色狀態欄
  5. 搖屁滾尿流您的設備,並選擇「啓用遠程調試JS」上彈出
  6. $ open "rndebugger://set-debugger-loc?host=192.168.1.231&port=8081"
    IP地址==地址在綠色的狀態欄中列出(在iPad的Wi​​Fi設置沒有解決)...