i am trying this code .i jst want to save the value to NSUserDefault,trying to hold the value of NSUserDefault to local var val1, and later on have to send this value val1 to server, but when i run build the application ,username = null appears… m in big trouble..plzzzz help me out….alternate code would be apprecaited…..Thanx in advance
NSUserDefaults *username = [NSUserDefaults standardUserDefaults];
[username setObject:utextFieldNormal.text forKey:@”username”];
//NSLog(@"username:%@",utextFieldNormal.text);
NSString *val1= [username valueForKey:@"username "];
NSLog(@"username:%@",val1);
[username synchronize]
You’ve seen the space there?
@"username " != @"username". Maybe that’s the source of your problem. And you should useobjectForKeyinstead ofvalueForKey.