Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve NSKeyedArchiver warning: replacing existing value

Tags:

objective-c

I have an object that implements serializable, and I have a dictionary with a few of that objects. When I compile and run, I get lots of warnings saying that I'm replacing values for keys. That happens because when serializing the next object in the dictionary, it stores it's variables with the same key as the previous one did, right? How can I solve this? is there a way to know in the encodeWithCoder method if any variable has been stored with that name?

like image 322
XaitormanX Avatar asked Apr 06 '12 12:04

XaitormanX


1 Answers

encodeWithCoder: has no problem with multiple dictionaries that have the same key or with the same key appearing in multiple objects. Your problem is more likely that you're encoding multiple things with the same key in the same object (i.e. in your calls to encodeObject:forKey:).

like image 188
Rob Napier Avatar answered Oct 25 '22 20:10

Rob Napier