Post

Replies

Boosts

Views

Activity

The replacement of NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data)
I currently found out that the NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? NSMutableArray) is depreciated and is recommended by the compiler to use NSKeyedUnarchiver.unarchivedObject(ofClass: NSMutableArray.self, from: data) instead. However, the NSKeyedUnarchiver.unarchivedObject always return nil. Our original NSMutableArrary, named array, stores our objects, such as, public class TestInfo { public var name1 = "" public var name2 = "" .... } those objects were set by using: NSKeyedArchiver.archivedData(withRootObject: array, requiringSecureCoding: false) set(data, forKey: key) We had tried several different methods such as: NSKeyedUnarchiver.unarchivedObject(ofClass: NSMutableData.self, from: data) but all failed with return value nil. Is there better replacement of "unarchiveTopLevelObjectWithData" there to use? Thanks
2
0
590
Feb ’24