NSKeyedArchiver does not work in Swift 3 ( XCode 8)

后端 未结 4 528
悲哀的现实
悲哀的现实 2021-02-02 14:41

I have migrated my project to Swift 3 and NSKeyedArchiver does not work. I actually have a runtime error when trying to decode object like this:

let         


        
4条回答
  •  鱼传尺愫
    2021-02-02 15:02

    UPDATE: I solved this problem by using decodeInteger(forKey key: String) instead of decodeObject(forKey key: String). By some reason AnyObject does not cast to Integer in Swift 3 though it did in Swift 2.2

提交回复
热议问题