Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react native networking not working after updating xcode to 8.3.2 #14083

Closed
alzalabany opened this issue May 21, 2017 · 4 comments
Closed

react native networking not working after updating xcode to 8.3.2 #14083

alzalabany opened this issue May 21, 2017 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@alzalabany
Copy link

alzalabany commented May 21, 2017

Description

all of a sudden, all my applications are getting Newtwork request failed after i updated my xcode to 8.3.2,

Network request failed
TypeError: Network request failed

i tried changing values in /ios/[projectname]/info.plist but still getting same error, even when i'm calling https:// endpoints.

<key>NSAppTransportSecurity</key>
	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
	<dict>
		<key>NSExceptionDomains</key>
		<dict>
			<key>localhost</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
		</dict>
	</dict>

Reproduction Steps and Sample Code

$ react-native init newProject && cd newProject && react-native run-ios

open index.ios.js and add test

            <Button title="fetch" onPress={async ()=>{
              const r = await fetch('http://localhost/ivf/system/settings');
              console.log(r);
            }}/>
            <Button title="fetchs" onPress={async ()=>{
              const r = await fetch('https://ivf.simpleinfroamtics.com/system/settings').catch(console.log);
              console.log(r);
            }}/>

by clicking on both links they both will fail with newtwok request failed.

i tried using xhr insteed

componentDidMount(){
var request = new XMLHttpRequest();
request.onreadystatechange = (e) => {
if (request.readyState !== 4) {
return;
}

if (request.status === 200) {
console.log('success', request.responseText);
} else {
console.warn('error');
}
};

request.open('GET', 'http://localhost/endpoint/');
request.send(); //will fail same error yet exactly same error.

how can we fix this ??? i already finished my whole app and i'm waitting to fix this so i can publish :(

List all the steps required to reproduce the issue you're reporting. These steps should be clear and concise.

  • React Native version: 0.44
  • Platform: IOS
  • Development Operating System: macOs xcode-8.3.2
@alzalabany
Copy link
Author

alzalabany commented May 21, 2017

its also good to mention, when i tried to use expo "create-react-native-app" and used same code above.
the requests to http://ivf.simple*.com went through successfuly, yet the localhost still fails

so i tried to "eject", now the app would not open, fatal error [No bundle URL present].

i think may be cause URL bundle is served over http and ios is blocking that ?!

@roszelj
Copy link

roszelj commented Jun 13, 2017

I'm having a similar problem, did you find any resolutions?

@alzalabany
Copy link
Author

must set security transport policies, its mandatory since xcode 8.1+

@hramos
Copy link
Contributor

hramos commented Aug 24, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Aug 24, 2017
@hramos hramos closed this as completed Aug 24, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Aug 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants