Hi,
I have my application's data and settings stored in 2 plist file, each containing several/many keys.*

I would like to to save the changed items permanently in my data store after the user interacts with the ui. Control elements are bound to a settings NSDictionary in my data model.


For any bindings notifications, the following method

- (void)registerAsObserver
{
    [model addObserver:self forKeyPath:@"prefs.debug"
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
                           context:NULL];
}

will only register for observing one value at a time. However I may have a wide variety of controls and settings that need to trigger the same code to write out the dictionary to the plist file (or to any arbitrary data storage mechanism i might use). And cant write anything like @"prefs.*" because this syntax does not constitute a valid key- path.
And if there is any way to listen for all values within a path or set.

So i am looking at other ways. Can you listen for all objects held by an NSArray ? This might be a useful alternative. Although probably very expensive to convert between NSDictionary <=> NSArray each time an element was changed. But i might try to change my data representation and avoid the NSDictionary altogether.

Of course there is the method setKeys: triggerChangeNotificationsForDependentKey: however i did find all the explanations about this really difficult to follow. Awhile back i tried doing with the apple example but unfortunately no luck. And don't the array of triggering keys need to be first registered individually anyway ? (perhaps thats why it failed to work for me).

Has anybody had successes with these or other method for multiple keys ?


*Note - no core data yet as i am a newbie and having core data in my app would be alot do all at once. But if this kind of issue is solved by a core data feature please let me know.

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to