1、URL地址设置
问题:
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://localhost:8081/index.ios.bundle?platform=ios&dev=true 2016-08-29 17:52:29.307 [error][tid:main][RCTWebSocketManager.m:84] WebSocket connection Failed with error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"
解决:
在AppDelegate.m
文件中,把一下代码中的localhost
改为你电脑的IP地址,并且保证连接的是同一个网络(例如:连接同一个路由的网络)。
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
2、HTTP设置
2016-08-29 18:01:20.273 AwesomeProject[688:263429] 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-08-29 18:01:20.316 [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://10.240.139.46:8081/index.ios.bundle?platform=ios&dev=true
开启ATS即可