views:

209

answers:

0

i saw this approach on a tutorial, and the message is working for their example but when i implement this it does not work. from what i can tell the iphone simulator crashes when i do a [ self saveSettingsData]. TheSettings is class object that i declare and initialize in the appdelagate with these methods. the error says terminating due to uncaught exception. i am new to the iphone sdk and objective, so i really can't figure out what is going on thanks to any one who can help, i am ready to literally pull my hair out.

- (NSString *) SettingsDataFilePath
{
    NSString * settingsDataFilePath ;
    NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ;
    NSString * documentsDirectory = [paths objectAtIndex:0] ;
    settingsDataFilePath = [[documentsDirectory stringByAppendingPathComponent: @"SetggggtingsData.plist" ] retain] ;
    return settingsDataFilePath ;
}

- (void) saveSettingsData 
{
    [NSKeyedArchiver archiveRootObject:[TheSettings copy] toFile:[self SettingsDataFilePath]] ;