BugsBiteBugs / sqlitepersistentobjects

Automatically exported from code.google.com/p/sqlitepersistentobjects
0 stars 0 forks source link

UIColor persistence fails due to private subclasses #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a persistent object with a UIColor property.
2. Set the property to [UIColor redColor].
3. Call save.
4. Reload from persistence.

What is the expected output? What do you see instead?

Expected: reloaded object has a UIColor property with a red color.
Actual: UIColor property in reloaded object is nil.

This is occurring because [UIColor redColor] returns an object of type 
UICachedDeviceRGBColor, 
not UIColor, and the keyed archiver uses the class name as a key.

What version of the product are you using? On what operating system?

iPhone OS 2.2

Please provide any additional information below.

Workaround is a custom persister for UIImage that uses a static key for the 
archiver.  I'm filing 
the bug because this is likely to be a common problem.

Original issue reported on code.google.com by paule...@gmail.com on 29 Dec 2008 at 1:28

Attachments:

GoogleCodeExporter commented 9 years ago
Heh, just reread the "workaround" section and realized that I should have 
written "UIColor", not "UIImage".  
Here's the category that persists UIColor objects.

Original comment by paule...@gmail.com on 5 Jan 2009 at 3:58

Attachments:

GoogleCodeExporter commented 9 years ago
I added the category to SVN, thank you.

Original comment by jeff.lam...@gmail.com on 19 Feb 2009 at 1:12