Open guojiubo opened 3 years ago
@guojiubo Thanks for the heads up! Could you please make a pull request?
I ran into the same problem and determined that MASDictionaryTransformer
was the way to go.
If you fix the deprecation warning and use NSSecureUnarchiveFromDataTransformerName
, it will leave you in a situation where your customer has data in the old format and the secure unarchive will fail (and throw an exception in the process).
It would be possible to do a one-time conversion from insecure to secure data, but this is tricky to detect (since you have to dig around in the data to determine when to perform the conversion.)
Instead, we just renamed the preference key and migrated to the dictionary transformer instead. It's easier to read, more compact, and I think it should be the default for this framework now.
Also forgot to mention that secure coding only allows for NSArray, NSDictionary, NSSet, NSString, NSNumber, NSDate, NSData, NSURL, NSUUID, and NSNull as top-level objects. So you'll be convertingMASShortcut
to something else during the transform - easier just to use the dictionary.
Thanks Craig!
Was there a PR for this? I have started to get the same warnings too.
I am a novice Objective-C/Swift coder so I may not be the best person to create a PR for this.
Looks like NSKeyedUnarchiveFromData is deprecated by Apple and I'm hitting this warning(console log):
Nice library btw, thanks for your awesome work.