I am executing the following code:
let createByDicc = [
"nickname" : self.createdBy?.nickname,
"avatar" : self.createdBy?.avatar,
"id" : self.createdBy?.id
] as! [String : String]
let dicc = [
"channelId" : self.channelId!,
"createBy" : createByDicc,
"message" : self.message!,
"type" : "message",
"replyTo" : "nmartello"
] as! [String : String]
I am positive that all the variables I am using are not null (self.createdBy?.nickname etc have a string assigned). If I comment out the
"createBy" : createByDicc'
it works just fine, but if not I get Unexpectedly found nil when unwrapping an Optional value . I need this Dictionary inside a Dictionary for the payload of a WS I need to call using Alamofire and I am not sure what it's wrong here. Any ideas?