0

I have NSDictionary with some keys. One key has object of custom NSObject type class.

If I try to use archivedDataWithRootObject: to get NSData from NSDictionary it crashes because of 1 key that has object of custom class.

I used NSCoding too for custom class's object key but got this error- '*** -encodeObject:forKey: cannot be sent to an abstract object of class NSCoder: Create a concrete instance!'

How to solve this?

  • 1
    Please provide the crashlog. – Christo Kumar Aug 13 '18 at 12:09
  • 1
    All classes which are going to be archived must adopt `NSCoding`. – vadian Aug 13 '18 at 13:46
  • @iChris its - *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CustomClass encodeWithCoder:]: unrecognized selector sent to instance 0x105254000' – user3581597 Aug 13 '18 at 13:50
  • 4
    Possible duplicate of [Unrecognized selector sent to instance while archiving data (NSCoding)](https://stackoverflow.com/questions/22168753/unrecognized-selector-sent-to-instance-while-archiving-data-nscoding) – il3v Aug 13 '18 at 13:51

0 Answers0