I've started using sqlpo for an iphone project and I love it!
Is there a way to receive a notification right after
SQLitePersistentObject is saved?
I did a workaround and it worked :
1. create a transient saveCount property
2. override save
- (void) save {
[super save];
self.saveCount += 1;
}
3. register key-value observing for saveCount, using
addObserver:forKeyPath:options:contex
but I'm looking for a better solution.
regards
Kenji
> I've started using sqlpo for an iphone project and I love it!
Good.
> Is there a way to receive a notification right after
> SQLitePersistentObject is saved?
>
> I did a workaround and it worked :
>
> 1. create a transient saveCount property
> 2. override save
> - (void) save {
> [super save];
> self.saveCount += 1;
> }
> 3. register key-value observing for saveCount, using
> addObserver:forKeyPath:options:contex
It really depends upon the granularity you need for the notification. There are many mechanisms you could use. If the above is sufficient, then go with it. That said, since you are not actually observing an ivar, why aren't you using the NSNotificationCenter? You could then dispense with the transient variable. NSNotification supports instance level observing.
Anon,
Andrew
____________________________________
Andrew W. Donoho
Donoho Design Group, L.L.C.
a...@DDG.com, +1 (512) 750-7596
"We did not come to fear the future.
We came here to shape it."
-- President Barack Obama, Sept. 2009
NSNotification seemed complicated to use at first sight
(I am new to Objective-C / Cocoa), but now that you've
recommended it and I looked in some more,
I guess I'll go this way.
Thanks,
Kenji
2010/3/18 Andrew W. Donoho <andrew...@gmail.com>: