Jane1234567 / sqlitepersistentobjects

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

new KVO changes prevent Collections with objects other than SQLitePersistent objects from saving. #40

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run Test SaveAndLoadData with Collections Fixture

2 this attempts to save a SQLite object with NSArray property containing
NSString objects

3. the object cannot detect that is it has become dirty and never saves.

4. The method observeValueForKeyPath does not get invoked when updating
data on a collection property of the object.

Original issue reported on code.google.com by amle...@gmail.com on 5 Feb 2009 at 10:20

GoogleCodeExporter commented 8 years ago
I added some changes today that might fix this. I overrode all the KV and KVO 
methods in 
SQLitePersistentObject, and marked the class as dirty before calling super. Can 
you please check to see if this 
fixes this problem when you get a chance?

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

GoogleCodeExporter commented 8 years ago
Doesn't seem like the changes have fixed the problem. 
Temporary work around is to always save the object if any property is a 
collection.

===================================================================
--- SQLitePersistentObject.m    (revision 76)
+++ SQLitePersistentObject.m    (working copy)
@@ -707,6 +707,9 @@
                }
                else
                {
+                   dirty = YES;
+                   break;
+                   

Original comment by amle...@gmail.com on 19 Feb 2009 at 10:26

GoogleCodeExporter commented 8 years ago
another approach I was trying was to subclass the NSMutableArray and have it 
hold a reference to the 
SQLite object. then intercept calls to objectAtIndex it and update the 
reference to be dirty.I've found this 
hard to implement because NSArray is a category and can't be subclassed easily.

Original comment by amle...@gmail.com on 19 Feb 2009 at 9:09