Reputation: 3002
I am downloading Json data from server using NSURLConnection class. I parse the data in background thread, however in connection() delegate method the app is crashing
. Below is the screenshot. The code is also available in the image below. Why is this happening?
Regards
UPDATE:
With breakpoints removed:
Upvotes: 0
Views: 320
Reputation: 69027
It seems that you are trying to use UIAlertView
and that is causing a crash. Now, from your code is not clear how you are doing that. In any case UIAlertView
is deprecated under iOS 8 and this might explain the issue when using Swift (although using deprecated methods or classes does not usually causes a crash in Obj-C).
You could try with a UIAlertController
and set its preferredStyle
to UIAlertControllerStyleAlert
:
var alert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
Upvotes: 1