Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

webznz

macrumors member
Original poster
Mar 8, 2011
82
0
Hobbitin
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

Code:
+ (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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.