ios - How to convert [String : String?] to [NSObject : AnyObject]! in Swift 2.0 for Firebase Api? -


how can convert [string : string?] [nsobject : anyobject]!?

right project using firebase backend swift app. after updated xcode 7 , swift 2.0,

i got error .updatechildvalues function , image below. enter image description here

how can fix this? thanks!

the problem values in dictionary of type string?, , contain nil. when dictionary passed objective-c code in firebase, it's converted nsdictionary. values in nsdictionary can't nil.

i'm guessing self.deckname.text or self.deckdetails.text returning string? instead of string part of sdk update in xcode 7. if you're absolutely never return nil, can add exclamation point after self.deckname.text and/or self.deckdetails.text unwrap string? string.

note if make bad assumption , return nil, program crash. if you're uncertain, self.deckname.text ?? "", means "return deckname.text if it's not nil, otherwise return empty string".


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -