我试图运行一个应用程序创建与反应本机(v0.3)没有连接到我的电脑。我已将该应用与react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios
捆绑在一起,并在我的连接iPhone上运行(在Xcode上也更改为Release
)。在iPhone上运行反应本机应用程序
这工作正常,即使(启动后)我禁用WiFi并从我的Mac断开手机。但如果我完全关闭应用程序并尝试重新启动它(没有连接WiFi或USB),它会崩溃(它显示应用程序屏幕并在几秒钟后崩溃)...
在启动时,我可以看到一个绿色条像“连接到192. *”(这可能是我的mac的IP地址)。我怎样才能完全禁用连接?该连接对调试非常有用,但不可能将该应用展示给某人。
取消注释在AppDelegate.m
的jsCodeLocation
部分作为official documentation建议是不是非常有帮助的,因为它是不可能有这样生成的代码:
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"weather"
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;
}
还是我失去了一些东西?
版本:
- OSX 10.11.5
- 的Xcode 7.3.1
- 阵营原住民0.3
- NPM 3.10.3
非常感谢,这工作! – Dennis