iphone - NSInvalidArgumentException/copyWithZone exception with NSMutableDictionary -


I have a class that I am encapsulating with ABRecordID and when it comes to adding a NSMutableDictionary to a key I used to run run-time exceptions:

"NSInvalidArgumentException: *** - [MyRecordId copyWithZone:]: Unfolded selector sent for example" < / P>

MyRecordId has been declared as:

@MyRecordId: NSObject {ABRecordID abRecordId; } - (id) initWithId: (ABRecordID) anABRecordId; @protty (nonatomic) Abe RecordsID Abraccharide ID; @end

Adding to dictionary:

  NSMutableDictionary * dict = [[NSMutableDictionary alloc] init]; MyRecordId * record id = [[MyRecordId alloc] initWithId: anABRecordId]; [Dict Set Object: @ "Hello" for: record id];  

The last line causes exception. I know that you can not store non-object types as a key for a dictionary but I thought NSObised derivative It's okay to wrap it in a square.

Did not I want to store Abe Records in other objects? Should I do something else? Use NSNumber to store ABRecordID in the OBJ-C class:

  [dict Set Object: @ "Hello" for KA: [NSNumber NumberHatah: Record id]];  

To get the record again, please:

  recordId = [[dict objectForKey: @ "hello"] intValue];  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -