From 0c53c6f7ed90ceebeb9bc155358cdfee852a7713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Fossli?= Date: Wed, 13 Jan 2016 14:18:07 +0100 Subject: [PATCH] Notes about app transport security MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error message wasn't very helpful. I didn't understand the problem until I debugged the `RCTJavaScriptLoader`. So this might be to help for others. Squashed commits by @andrewsardone into @hfossli’s [original commit][oc]: [oc]: https://github.com/andrewsardone/react-native/commit/39fa5ca95b26014c17b3613de5166a587c8bf4c9 - Expand App Transport Security docs w/ localhost tip - Tweak ATS error note in EmbeddedAppIOS docs - Per @satya164’s [recommendation][r], using the exact copy he recommended. [r]: https://github.com/facebook/react-native/pull/5290#discussion_r49843876 --- docs/EmbeddedAppIOS.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/EmbeddedAppIOS.md b/docs/EmbeddedAppIOS.md index 4c4b99952..cb9fd76ce 100644 --- a/docs/EmbeddedAppIOS.md +++ b/docs/EmbeddedAppIOS.md @@ -161,6 +161,28 @@ In root directory, we need to start React Native development server. This command will start up a React Native development server within our CocoaPods dependency to build our bundled script. The `--root` option indicates the root of your React Native apps – this will be our `ReactComponents` directory containing the single `index.ios.js` file. This running server will package up the `index.ios.bundle` file accessible via `http://localhost:8081/index.ios.bundle`. +## Update App Transport Security + +On iOS 9 and above the app won't be a able to connect over http to localhost unless specifically told so. See this thread for alternatives and instructions: http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http. + +It is recommended that you add an App Transport Security exception for `localhost` in your app's `Info.plist` file: + +```xml +NSAppTransportSecurity + + NSExceptionDomains + + localhost + + NSTemporaryExceptionAllowsInsecureHTTPLoads + + + + +``` + +If you don't do this, you will see the error - `Could not connect to development server.` when connecting to your server over http. + ## Compile And Run Now compile and run your app. You shall now see your React Native app running inside of the `ReactView`.