使用NSUserDefaults保存简单的用户数据

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

NSString *yourPosition = [prefs stringForKey:@"position"];

NSLog(@"Your position is: %@",yourPosition);


//To set a default

NSString *newPosition = @"here";

[prefs setObject: newPosition forKey:@"position"];

你可能感兴趣的:(NSUserDefaults)