0

I am trying to run my Swift 1.0 syntax and am getting an error "Can call throw but it is not marked with try and the error is not handled.".

I tried adding a try / catch but a similar error occurs.

Here is the line of code:

        let jsonResult: NSDictionary! = NSJSONSerialization.JSONObjectWithData(data!, options:NSJSONReadingOptions.MutableContainers) as? NSDictionary

I tried:

do {  
    let jsonResult: NSDictionary! = NSJSONSerialization.JSONObjectWithData(data!, options:NSJSONReadingOptions.MutableContainers) as? NSDictionary  
} catch _ {  
    //Error handling, if needed  
} 

but I get "Can throw but was not marked as try".

Please help

Also doesnt work when I try this:

dbus
  • 73
  • 1
  • 6

0 Answers0