1

I tried to change ip address that I could test on the device.

After changing lines in AppDelegate.m I did rebuild the application and restarted the server (npm start).

As you can see, the server is visible from the browser, everything works fine, but inside the app says that cannot connect to the server.

jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.1:8081/index.ios.bundle?platform=ios&dev=true"];

After restart project I see:

2016-07-01 13:12:07.949 PropertyFinder[10626:5440580] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
2016-07-01 13:12:09.964 [fatal][tid:main] Could not connect to development server.

Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate

URL: http://192.168.1.1:8081/index.ios.bundle?platform=ios&dev=true

Screenshot: http://dl2.joxi.net/drive/2016/07/01/0001/2707/121491/91/faf405e34d.png

I also tried open this ip in Safari Simulator: http://joxi.ru/RmzQBJKHWkJVOr

Solution: I had to use react-native start not npm start

Ivo Dimitrov
  • 307
  • 1
  • 4
  • 12
  • As i can see first you have to fix _App Transport Security has blocked a cleartext HTTP_ this issue. follow this _[Transport security has blocked a cleartext HTTP](http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http)_. – Ashok R Jul 01 '16 at 12:43

1 Answers1

0

You also need to add the NSAllowsArbitraryLoads key in Info.plist, next to the NSExceptionDomains key, like this:

<key>NSAppTransportSecurity</key>
<dict>
 <key>NSExceptionDomains</key>
 <dict>
   [...]
 </dict>
 <key>NSAllowsArbitraryLoads</key>
   <true/>
</dict>
Yupichaks
  • 202
  • 1
  • 2
  • 10