Closed SergeyPetrovi4 closed 8 years ago
How to solve this?
I pack contacts array (APContact) to NSData
NSKeyedArchiver.archivedDataWithRootObject(contactsArray)
This worked, but when I tried unpack this data in another method I have ExeptionError
let addressBook = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? [APContact]
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[APContact initWithCoder:]: unrecognized selector sent to instance
You can create category APContact+NSCoder and implement initWithCoder: method there.
APContact+NSCoder
initWithCoder:
Big thanks ;)
How to solve this?
I pack contacts array (APContact) to NSData
This worked, but when I tried unpack this data in another method I have ExeptionError