How to set Dictionary in NSUserDefault in swift?
问题 I've a mutable dictionary (in form of [Int:Int]) and want that to save it. I would use NSUserDefaults like that: var myDic: NSMutableDictionary = [:] myDic = [1:2] NSUserDefaults.standardUserDefaults().setObject(myDic, forKey: "myDic") but with that I get an error: Thread 1: signal SIGABRT I have no idea why. 回答1: setObject(_:forKey:) can’t accept Dictionary with a key which is integer type. The method requires property-list objects, but myDic = [1:2] is not property-list object. There are