Skip to content

Commit bbd5259

Browse files
committed
Fixed reachability
1 parent 2d5d55d commit bbd5259

6 files changed

Lines changed: 127 additions & 82 deletions

File tree

Examples/2048/2048/AppDelegate.m

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2222
{
2323
NSURL *jsCodeLocation;
2424

25-
// Loading JavaScript code - uncomment the one you want.
26-
27-
// OPTION 1
28-
// Load from development server. Start the server from the repository root:
29-
//
30-
// $ npm start
31-
//
32-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
33-
// iOS device are on the same Wi-Fi network.
25+
/**
26+
* Loading JavaScript code - uncomment the one you want.
27+
*
28+
* OPTION 1
29+
* Load from development server. Start the server from the repository root:
30+
*
31+
* $ npm start
32+
*
33+
* To run on device, change `localhost` to the IP address of your computer
34+
* (you can get this by typing `ifconfig` into the terminal and selecting the
35+
* `inet` value under `en0:`) and make sure your computer and iOS device are
36+
* on the same Wi-Fi network.
37+
*/
38+
3439
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.includeRequire.runModule.bundle"];
3540

36-
// OPTION 2
37-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
38-
//
39-
// $ curl http://localhost:8081/Examples/2048/Game2048.includeRequire.runModule.bundle -o main.jsbundle
40-
//
41-
// and uncomment the next following line
42-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
41+
/**
42+
* OPTION 2
43+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
44+
* to your Xcode project folder in the terminal, and run
45+
*
46+
* $ curl 'http://localhost:8081/Examples/2048/Game2048.includeRequire.runModule.bundle' -o main.jsbundle
47+
*
48+
* then add the `main.jsbundle` file to your project and uncomment this line:
49+
*/
50+
51+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
4352

4453
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4554
moduleName:@"Game2048"

Examples/Movies/Movies/AppDelegate.m

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2323
{
2424
NSURL *jsCodeLocation;
2525

26-
// Loading JavaScript code - uncomment the one you want.
26+
/**
27+
* Loading JavaScript code - uncomment the one you want.
28+
*
29+
* OPTION 1
30+
* Load from development server. Start the server from the repository root:
31+
*
32+
* $ npm start
33+
*
34+
* To run on device, change `localhost` to the IP address of your computer
35+
* (you can get this by typing `ifconfig` into the terminal and selecting the
36+
* `inet` value under `en0:`) and make sure your computer and iOS device are
37+
* on the same Wi-Fi network.
38+
*/
2739

28-
// OPTION 1
29-
// Load from development server. Start the server from the repository root:
30-
//
31-
// $ npm start
32-
//
33-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
34-
// iOS device are on the same Wi-Fi network.
3540
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle"];
3641

37-
// OPTION 2
38-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
39-
//
40-
// $ curl http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle -o main.jsbundle
41-
//
42-
// and uncomment the next following line
43-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
42+
/**
43+
* OPTION 2
44+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
45+
* to your Xcode project folder in the terminal, and run
46+
*
47+
* $ curl 'http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle' -o main.jsbundle
48+
*
49+
* then add the `main.jsbundle` file to your project and uncomment this line:
50+
*/
51+
52+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
4453

4554
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4655
moduleName:@"MoviesApp"

Examples/SampleApp/iOS/AppDelegate.m

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1717
{
1818
NSURL *jsCodeLocation;
1919

20-
// Loading JavaScript code - uncomment the one you want.
21-
22-
// OPTION 1
23-
// Load from development server. Start the server from the repository root:
24-
//
25-
// $ npm start
26-
//
27-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
28-
// iOS device are on the same Wi-Fi network.
20+
/**
21+
* Loading JavaScript code - uncomment the one you want.
22+
*
23+
* OPTION 1
24+
* Load from development server. Start the server from the repository root:
25+
*
26+
* $ npm start
27+
*
28+
* To run on device, change `localhost` to the IP address of your computer
29+
* (you can get this by typing `ifconfig` into the terminal and selecting the
30+
* `inet` value under `en0:`) and make sure your computer and iOS device are
31+
* on the same Wi-Fi network.
32+
*/
33+
2934
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/SampleApp/index.ios.bundle"];
3035

31-
// OPTION 2
32-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
33-
//
34-
// $ curl 'http://localhost:8081/Examples/SampleApp/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle
35-
//
36-
// and uncomment the next following line
37-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
36+
/**
37+
* OPTION 2
38+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
39+
* to your Xcode project folder in the terminal, and run
40+
*
41+
* $ curl 'http://localhost:8081/Examples/SampleApp/index.ios.bundle?dev=false&minify=true' -o main.jsbundle
42+
*
43+
* then add the `main.jsbundle` file to your project and uncomment this line:
44+
*/
45+
46+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
3847

3948
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4049
moduleName:@"SampleApp"

Examples/TicTacToe/TicTacToe/AppDelegate.m

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2222
{
2323
NSURL *jsCodeLocation;
2424

25-
// Loading JavaScript code - uncomment the one you want.
26-
27-
// OPTION 1
28-
// Load from development server. Start the server from the repository root:
29-
//
30-
// $ npm start
31-
//
32-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
33-
// iOS device are on the same Wi-Fi network.
25+
/**
26+
* Loading JavaScript code - uncomment the one you want.
27+
*
28+
* OPTION 1
29+
* Load from development server. Start the server from the repository root:
30+
*
31+
* $ npm start
32+
*
33+
* To run on device, change `localhost` to the IP address of your computer
34+
* (you can get this by typing `ifconfig` into the terminal and selecting the
35+
* `inet` value under `en0:`) and make sure your computer and iOS device are
36+
* on the same Wi-Fi network.
37+
*/
38+
3439
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle"];
3540

36-
// OPTION 2
37-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
38-
//
39-
// $ curl http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle -o main.jsbundle
40-
//
41-
// and uncomment the next following line
42-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
41+
/**
42+
* OPTION 2
43+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
44+
* to your Xcode project folder in the terminal, and run
45+
*
46+
* $ curl 'http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle' -o main.jsbundle
47+
*
48+
* then add the `main.jsbundle` file to your project and uncomment this line:
49+
*/
50+
51+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
4352

4453
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4554
moduleName:@"TicTacToeApp"

Examples/UIExplorer/UIExplorer/AppDelegate.m

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2222
{
2323
NSURL *jsCodeLocation;
2424

25-
// Loading JavaScript code - uncomment the one you want.
26-
27-
// OPTION 1
28-
// Load from development server. Start the server from the repository root:
29-
//
30-
// $ npm start
31-
//
32-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
33-
// iOS device are on the same Wi-Fi network.
25+
/**
26+
* Loading JavaScript code - uncomment the one you want.
27+
*
28+
* OPTION 1
29+
* Load from development server. Start the server from the repository root:
30+
*
31+
* $ npm start
32+
*
33+
* To run on device, change `localhost` to the IP address of your computer
34+
* (you can get this by typing `ifconfig` into the terminal and selecting the
35+
* `inet` value under `en0:`) and make sure your computer and iOS device are
36+
* on the same Wi-Fi network.
37+
*/
38+
3439
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/UIExplorer/UIExplorerApp.includeRequire.runModule.bundle?dev=true"];
3540

36-
// OPTION 2
37-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
38-
//
39-
// $ curl http://localhost:8081/Examples/UIExplorer/UIExplorerApp.includeRequire.runModule.bundle -o main.jsbundle
40-
//
41-
// and uncomment the next following line
42-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
41+
/**
42+
* OPTION 2
43+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
44+
* to your Xcode project folder and run
45+
*
46+
* $ curl 'http://localhost:8081/Examples/UIExplorer/UIExplorerApp.includeRequire.runModule.bundle' -o main.jsbundle
47+
*
48+
* then add the `main.jsbundle` file to your project and uncomment this line:
49+
*/
50+
51+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
4352

4453
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4554
moduleName:@"UIExplorerApp"

Libraries/Network/RCTReachability.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ @implementation RCTReachability
2525

2626
@synthesize bridge = _bridge;
2727

28+
RCT_EXPORT_MODULE()
29+
2830
static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
2931
{
3032
RCTReachability *self = (__bridge id)info;
@@ -53,8 +55,6 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
5355
}
5456
}
5557

56-
RCT_EXPORT_MODULE()
57-
5858
#pragma mark - Lifecycle
5959

6060
- (instancetype)initWithHost:(NSString *)host
@@ -71,7 +71,7 @@ - (instancetype)initWithHost:(NSString *)host
7171

7272
- (instancetype)init
7373
{
74-
return [self initWithHost:@"http://apple.com"];
74+
return [self initWithHost:@"apple.com"];
7575
}
7676

7777
- (void)dealloc

0 commit comments

Comments
 (0)