nsuserdefault not able to save values.

Posted by pankaj on Stack Overflow See other posts from Stack Overflow or by pankaj
Published on 2010-04-12T14:23:32Z Indexed on 2010/04/12 14:53 UTC
Read the original article Hit count: 197

Filed under:

hi i am trying to use nsuser defaults to save some default values in database. I am able to save the values in the nsuserdefault(even checked it in nslog). Now i need the values in app delegate when the application is restarted. But i am not getting anything in the nsuserdefault. Following is my code from my class where i save the values in nsuserdefault:

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

            [prefs setObject:appDel.dictProfile forKey:@"dict"];
            NSLog(@"%@",[prefs valueForKey:@"dict"]);

Following is my code from App Delegagte:

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

NSLog(@"%@",[prefs valueForKey:@"dict"]);

the above code always returns me null. Can some one please help me

© Stack Overflow or respective owner

Related posts about iphone