switch to use method decodeObjectOfClass:forKey: to decode an object#302
switch to use method decodeObjectOfClass:forKey: to decode an object#302ihomway wants to merge 1 commit intoibireme:masterfrom
decodeObjectOfClass:forKey: to decode an object#302Conversation
Codecov Report
@@ Coverage Diff @@
## master #302 +/- ##
=======================================
Coverage 99.28% 99.28%
=======================================
Files 2 2
Lines 1540 1540
=======================================
Hits 1529 1529
Misses 11 11
Continue to review full report at Codecov.
|
|
In order to conform to NSSecureCoding: In addition, the class must override the getter for its Link: NSSecureCoding |
Hello bireme,
Here is the reason why this pull request happened.
I have a model like this:
I'd like to use
NSSecureCodingrather thanNSCoding. Then something unexpected happened. I canNSKeyedArchiverto save this model to disk successfully, but I cannot read and unarchive it from the disk. There's an error.After debug, I found it is because the
NSURLproperty. This property cannot be unarchived inyy_modelInitWithCoder:with methoddecodeObjectforKey:. We have to usedecodeObjectOfClass:forKey:.Here is the example code to save and read this mode: