Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将数据保存在NSCache中Swift 3.0?
NSCache
Swift 3.0
lazy var cache = NSCache<NSString, AnyObject>()
当我尝试创建这样的数组时,出现错误:
“类型‘数据’不符合‘AnyObject’”
在Swift 2.0中,以下代码有效:
Swift 2.0
lazy var cache = NSCache()