What is the use of -[NSUserDefaults registerDefaults:]?
问题 What is the difference between: [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithObjectAndKey:anObject, @"something"]]; And this: [[NSUserDefaults standardUserDefaults] setObject:anObject forKey:@"something"]; 回答1: The difference is that the first code-snippet you register defaults that will be used when the user has not made any changes to the "property". So if you want to provide let's say a "property" with the key name 'Welcome message', you could