Downcast from'[NSObject:AnyObject]?'to'Dictionary'only unwraps

Downcast from'[NSObject:AnyObject]?'to'Dictionary<NSObject,AnyObject>'only unwraps

错误代码:

var info:Dictionary<String,Int>! = notification.userInfo  as! Dictionary

正确代码:

2

var info:Dictionary<String,Int>! = notification.userInfo as! AnyObject as! Dictionary



你可能感兴趣的:(Downcast from'[NSObject:AnyObject]?'to'Dictionary'only unwraps)