How to resolve NSKeyedArchiver warning: replace existing value

I have an object that implements serializable, and I have a dictionary with several of these objects. When I compile and run, I get a lot of warnings that I am replacing values ​​for keys. This is because when serializing the next object in the dictionary, it stores the variables with the same key as the previous one, right? How can i solve this? is there any way to find out in the encodeWithCoder method if any variable has been saved with that name?

+5
source share
1 answer

encodeWithCoder:It does not have problems with several dictionaries that have the same key or the same key appearing in several objects. Your problem is more likely that you are encoding several things with the same key in the same object (i.e. in your calls encodeObject:forKey:).

+16
source

All Articles