1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | #import "AppDelegate.h"
|
11 |
|
12 | #if __has_include("RCTRootView.h")
|
13 | #import "RCTRootView.h"
|
14 | #else
|
15 | #import <React/RCTRootView.h>
|
16 | #endif
|
17 |
|
18 | @implementation AppDelegate
|
19 |
|
20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
21 | {
|
22 | NSURL *jsCodeLocation;
|
23 |
|
24 | // Loading JavaScript code - uncomment the one you want.
|
25 |
|
26 | // OPTION 1
|
27 | // Load from development server. Start the server from the repository root:
|
28 | //
|
29 | // $ npm start
|
30 | //
|
31 | // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
|
32 | // iOS device are on the same Wi-Fi network.
|
33 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/IntegrationTests/IntegrationTestsApp.includeRequire.runModule.bundle?dev=true"];
|
34 |
|
35 | // OPTION 2
|
36 | // Load from pre-bundled file on disk. To re-generate the static bundle, run
|
37 | //
|
38 | // $ curl http://localhost:8081/IntegrationTests/IntegrationTestsApp.includeRequire.runModule.bundle -o main.jsbundle
|
39 | //
|
40 | // and uncomment the next following line
|
41 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
42 |
|
43 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
|
44 | moduleName:@"IntegrationTestsApp"
|
45 | launchOptions:launchOptions];
|
46 |
|
47 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
48 | UIViewController *rootViewController = [[UIViewController alloc] init];
|
49 | rootViewController.view = rootView;
|
50 | self.window.rootViewController = rootViewController;
|
51 | [self.window makeKeyAndVisible];
|
52 | return YES;
|
53 | }
|
54 |
|
55 | @end
|