Wednesday 15 August 2012

json - Swift Error while NSURLSession.sharedSession() -



json - Swift Error while NSURLSession.sharedSession() -

currently run problem don't understand, different string should not alter anything.

this 1 crashes app

https://euw.api.pvp.net/api/lol/euw/v1.4/summoner/by-name/jüjük?api_key=5c7d4d4f-f320-43d5-8647-643c9f6ee5de

this 1 works without problems

https://euw.api.pvp.net/api/lol/euw/v1.4/summoner/by-name/smirknaitia?api_key=5c7d4d4f-f320-43d5-8647-643c9f6ee5de

here code:

allow url = nsurl(string: urlpath) allow session = nsurlsession.sharedsession() allow task = session.datataskwithurl(url!, completionhandler: {data, response, error -> void in if (error != nil) { println(error) } else { allow jsoneresult = nsjsonserialization.jsonobjectwithdata(data, options: nsjsonreadingoptions.mutablecontainers, error: nil) nsdictionary println(jsoneresult) } }) task.resume()

it crashes in let task0 = session0.datataskwithurl(url0!, completionhandler: {data, response, error -> void in error message:

thread1: exc_bad_instruction (code=exc_i386_invop, subcode=0x0)

any clue brings causes error , how prepare it?

json parsing swift

No comments:

Post a Comment