I have the following class
class BannerResponse : NSObject{
let URL = \"Url\";
let CONTACT_NO = \"ContactNo\";
let IMAGE
You are getting null values for some of your keys. They get mapped to NSNull by NSJSONSerialization.
You need to do several things
Change all your variables (url
, contactNo
, etc) to optionals:
var url:String?
var contactNo:String?
Change all of your assignments to use ?
instead of !
:
url = noNulls[URL] as? String
contactNo = noNulls[CONTACT_NO] as? String
And finally, make your code handle nil values for all of your variables. (But do not use !
. That path leads to crashes.)