Settings.Bundle how do you update?

Discussion in 'iOS Programming' started by webznz, Apr 10, 2011.

  1. webznz macrumors member

    Mar 8, 2011
    Hi there I am currently setting up a settings bundle which is all sorted, its used to store a string of numbers that will initially be set by the user, from then on it will be checked at the applications launch every launch then updated with a new key from the server it connects to.

    So far i am able to manually set the first key in the cookie.m file which then sends me back another cookie from the database that i catch.

    I have also implemented the settings.bundle which shows up under the iPhone main setting tab, also i have added this class in myappdelegate.m file

    + (void)initialize {
    	NSString *path = [[NSBundle mainBundle] bundlePath];
    	NSString *pListPath = [path stringByAppendingPathComponent:@"Settings.bundle/Root.plist"];
    	NSDictionary *pList = [NSDictionary dictionaryWithContentsOfFile:pListPath];
    	NSMutableArray *prefsArray = [pList objectForKey:@"PrefrenceSpecifiers"];
    	NSMutableDictionary *regDictionary = [NSMutableDictionary dictionary];
    	for (NSDictionary *dict in prefsArray){
    		NSString *key = [dict objectForKey:@"Key"];
    		if (key) {
    			id value = [dict objectForKey:@"DefaultValue"];
    			[regDictionary setObject:value forKey:key];
    	[[NSUserDefaults standardUserDefaults] registerDefaults:regDictionary];
    which initializes the setting bundle defaults.. what I am now wondering is how do i update my cookie field that i am catching in my cookie.m file?

Share This Page