0

I have an application made in Swift that uses NSUrl and NSData to get a JSON response from an API.

If I am on cellular data, the app closes as soon as it tries to make the connection. On WiFi (or the emulator) it is fine.

I found this article which seems to show there might be a bug, but its not based in Swift and it's not using the same components.

How can I set the "setAllowCellularAccess" option in my application?

My code:

let loginUrl = "<my server URL>"
var message  :String
var success : Int
var endPoint = NSUrl(string: loginUrl + username + "/" + password)
var data = NSData(contentsOfUrl: endPoint!)
Community
  • 1
  • 1
Mr Pablo
  • 4,109
  • 8
  • 51
  • 104
  • What do you mean by app closes. Is it crashes? what is the error you are getting? have you tried to debug? – Vizllx Aug 04 '15 at 13:56
  • On the iPad, on 3G data, it simply closes. No error popups or anything. I can't debug via the emulator, so I'll try find a cable to get the iPad hooked up.. – Mr Pablo Aug 04 '15 at 13:58
  • Just debug by connecting your device with mac, check console log in Xcode by setting "All Exception breakpoint" – Vizllx Aug 04 '15 at 14:01
  • Hmm, looks like the iPad I have on hand currently (a clients) has an older version of iOS that I can'y use with XCode :/ Regardless, have you any idea how to fix the issue? I'm sure I need to set the "setAllowCellularAccess" option, but I don't know how – Mr Pablo Aug 04 '15 at 14:04
  • When debugging, I get a message about turning on cellular data, but that doesn't seem to show up when installing from the App Store... – Mr Pablo Aug 05 '15 at 09:38

0 Answers0