Post

Replies

Boosts

Views

Activity

How to resolve - unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0
I am trying to replace the deprecated unarchiveObjectWithData API with unarchivedObjectOfClass. My class looks something like this Class B:<<NSSecureCoding> { +(BOOL)supportsSecureCoding { return YES; } } Class C <<NSSecureCoding> { property of class B; + (BOOL)supportsSecureCoding { return YES; } } Class A<<NSSecureCoding> { property of class B property of class c (BOOL)supportsSecureCoding { return YES; } } Tried solutions: Option 1: Archive code NSData *archiveData = [NSKeyedArchiver archivedDataWithRootObject:(array of objects of type A) requiringSecureCoding:YES error:&error]; // Encrypting archiveData and writing to file Unarchive code // fetching data from file // decrypting it NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; NSKeyedUnarchiver *unArchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:decryptedData error:&error]; [unArchiver setRequiresSecureCoding:YES]; array of objects of Type A = [unArchiver decodeObjectOfClasses:classesSet forKey:NSKeyedArchiveRootObjectKey]; Issue: Unable to unarchive all the properties. Properties have nil values including properties of type NSString, BOOL, custom class Option: 2 Use +unarchivedObjectOfClass:fromData:error Unarchive code: NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; array of objects of Type A = [NSKeyedUnarchiver unarchivedObjectOfClasses:classesSet fromData:storeData error:&error] Issue: "UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'Class B'. Allowed classes are '{NSMutable Array}" Can someone please assist with this issue. I have tried all the available solutions online. I couldn't find a documentation from Apple on how to consume the new API in a correct way.
2
0
802
Jul ’23
unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0 - Use +unarchivedObjectOfClass:fromData:error: instead
I am trying to replace the deprecated unarchiveObjectWithData API with unarchivedObjectOfClass. My class looks something like this Class B:< { (BOOL)supportsSecureCoding { return YES; } } Class C < { property of class B; (BOOL)supportsSecureCoding { return YES; } } Class A< { property of class B property of class c (BOOL)supportsSecureCoding { return YES; } } Tried solutions: Archive code NSData *archiveData = [NSKeyedArchiver archivedDataWithRootObject:(array of objects of type A) requiringSecureCoding:YES error:&error]; // Encrypting archiveData and writing to file Unarchive code // fetching data from file // decrypting it NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; NSKeyedUnarchiver *unArchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:decryptedData error:&error]; [unArchiver setRequiresSecureCoding:YES]; array of objects of Type A = [unArchiver decodeObjectOfClasses:classesSet forKey:NSKeyedArchiveRootObjectKey]; Issue: Unable to unarchive all the properties. Properties have nil values including properties of type NSString, BOOL, custom class Use +unarchivedObjectOfClass:fromData:error Unarchive code: NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; array of objects of Type A = [NSKeyedUnarchiver unarchivedObjectOfClasses:classesSet fromData:storeData error:&error] Issue: "UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'Class B'. Allowed classes are '{NSMutable Array}" Can someone please assist with this issue. I have tried all the available solutions online. I couldn't find a documentation from Apple on how to consume the new API in a correct way.
2
0
977
Jul ’23
Need help in implementing the smart card based authentication in an iOS app
Hi, I am trying to implement an app which performs cert based authentication through smart card. I have few queries related to the same I have included com.apple.token in the key chain accessory group. I am able to fetch the certificates from the keychain using Yubi key Type c. But this is not working for Yubi key lighting port. Does Apple support lighting port readers? What is the need of crypto token kit extension if we are able to list the certificates from key chain just by adding com.apple.token in the entitlements file.
1
0
1k
Jun ’23