在0.39下运行真机的设置,网上很多都是之前0.2前版本的,现做个更新。
- 先获取你的mac ip地址。可以在系统设置里面看到。
2.在 xcode代码appDelegate.m里面
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
//设置状态栏颜色
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
// NSURL *jsCodeLocation;
[[RCTBundleURLProvider sharedSettings] setDefaults];
#if DEBUG
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"换上你的ip"];
#endif
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
if DEBUG
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"换上你的ip"];
endif
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
其实就是加上这句话。
接着就可以开心的运行了,但是基础环境你首先得搭建好,别忘记了。