我在 iPhone 上运行 React-Native 应用程序,该应用程序似乎加载正常,但当我摇晃并启用远程 JS 调试时,出现此错误:
我尝试遵循 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
任何帮助将不胜感激,我正在尝试在真实设备上运行和调试 React-Native 应用程序。
谢谢,道格。
最佳答案
有时会超时。我一般都是按照这个步骤来的。 1. 摇一摇,然后停止远程调试。 2. 让它运行。 3、再次摇一摇,重新开启远程调试。 4. 应该重新加载。你应该可以走了。
我知道这很烦人......
关于ios - React-Native 远程调试器无法在 iPhone 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38483433/