Skip to content

Instantly share code, notes, and snippets.

@guange2015
Created May 21, 2012 07:22
Show Gist options
  • Save guange2015/2760931 to your computer and use it in GitHub Desktop.
Save guange2015/2760931 to your computer and use it in GitHub Desktop.
plist 读取与写入
//系统
NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* version = [infoDict objectForKey:@"CFBundleVersion"];
//写入
NSMutableDictionary* dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ];
[ dict setObject:@"Yes" forKey:@"RestartSpringBoard" ];
[ dict writeToFile:@"/Sample.plist" atomically:YES ];
//读取
NSMutableDictionary* dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ];
NSString* object = [ dict objectForKey:@"RestartSpringBoard" ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment