I have a custom object class which I need to encode. I have implementing the coding protocol, and I have managed to encode every object apart from the NSMutableDictionary object within the class. When I try to encode that, I get this error
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only support RGBA or the White color space, this method is a hack.'
Now, this dictionary class contains a lot of different custom objects I have set up. When I search online, I find this
Saving [UIColor colorWithPatternImage:image] UIColor to Core Data using NSKeyedArchiver
But doesn’t really apply to my situation. One of the custom classes is a custom colour class I have set up which creates a hex dex string out of RGB values, I went and added encoding that one, and I tested saving a colour object after adding the encoding protocol to it, and it works fine. But still get same error when I try to encode the dictionary. Do I have to go through every single custom object that that dictionary contains and add the encoding protocol to each one? I have quite a large number of custom objects, so this would be quite a time consuming task. Also I don’t get why I am getting the colour error for trying to archive a dictionary.
Is there a better way to save a custom object? I find the encoding method to be rather annoying way to save custom objects. Is there any better or quicker way of achieving this?
Thanks in advance
Most definately, yes!