react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[iOS 0.29.0]TypeError: Network request failed

Open liuhong1happy opened this issue 10 years ago • 11 comments

TypeError: Network request failed
    at XMLHttpRequest.xhr.onerror (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:24437:8)
    at XMLHttpRequest.dispatchEvent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:9960:15)
    at XMLHttpRequest.setReadyState (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25890:6)
    at XMLHttpRequest.__didCompleteResponse (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25748:6)
    at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25823:52
    at RCTDeviceEventEmitter.emit (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:9191:23)
    at MessageQueue.__callFunction (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7279:23)
    at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7183:8
    at guard (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7131:1)
    at MessageQueue.callFunctionReturnFlushedQueue (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7182:1)

Please tell me ! What can I do something to solve the problem ?

liuhong1happy avatar Jul 13 '16 09:07 liuhong1happy

Had same problem, solved by adding

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

to Info.plist

ksarna avatar Jul 13 '16 14:07 ksarna

@ksarna This is exactly the solution. Thanks a lot.

wty1990000 avatar Jul 14 '16 04:07 wty1990000

@ksarna But it did not work for me.. How can i solve..?

swaroopa94 avatar Jul 18 '16 05:07 swaroopa94

didn't work for me too :(

react-native 0.30.0 node v6.3.1

walter0331 avatar Jul 29 '16 03:07 walter0331

@facebook-github-bot stack-overflow

grabbou avatar Jul 29 '16 20:07 grabbou

Hey @liuhong1happy and thanks for posting this! @grabbou tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.

ghost avatar Jul 29 '16 20:07 ghost

@ksarna - not working for me either (and I don't see the Stack Overflow thread) is it possible to see a screen shot of your info.plist file? When I edit my info.plist file in raw xml then I can't open in xcode - btw I'm using xcode 7.3, most of the suggestions appear to be a different version

TheoGit avatar Aug 04 '16 19:08 TheoGit

Please someone help me on this issue. I am stuck with the network error. Can' do anything. I have also set the "Allows Arbitrary Loads" to YES.

anandbhardwaj avatar Aug 06 '16 20:08 anandbhardwaj

here is the full strack trace. "TypeError: Network request failed at XMLHttpRequest.xhr.onerror (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:24386:8) at XMLHttpRequest.dispatchEvent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:9896:15) at XMLHttpRequest.setReadyState (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25901:6) at XMLHttpRequest.__didCompleteResponse (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25759:6) at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25834:52 at RCTDeviceEventEmitter.emit (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:9127:23) at MessageQueue.__callFunction (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7207:23) at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7108:8 at guard (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7055:1) at MessageQueue.callFunctionReturnFlushedQueue (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7107:1)"

anandbhardwaj avatar Aug 06 '16 20:08 anandbhardwaj

I fixed it by changing those settings via the XCode UI - it didn't work when I changed directly in the plist file

TheoGit avatar Aug 06 '16 21:08 TheoGit

One bad news for developers using NSAppTransportSecurity. 😔

UPDATE: [Apple will require HTTPS connections for iOS apps by the end of 2016] https://techcrunch.com/2016/06/14/apple-will-require-https-connections-for-ios-apps-by-the-end-of-2016/

delef avatar Aug 22 '16 20:08 delef