mardi 4 août 2015

Using cellular data crashes application when using NSUrl + NSData

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!)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire