plist文件是标准的xml文件,在cocoa中可以很简单地使用。这里介绍一下使用方法:
以下代码在Mac和iPhone中均适用。
写入plist文件:
-
NSMutableDictionary*
dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ]; -
[
dict setObject:@"Yes" forKey:@"RestartSpringBoard" ]; -
[
dict writeToFile:@"/Sample.plist" atomically:YES ];
读取plist文件:
-
NSMutableDictionary*
dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ]; -
NSString*
object = [ dict objectForKey:@"RestartSpringBoard" ];
Many people transfer da
So you’re probably thinking, “So, great I’ll just keep doing that.” I did too until I went to on
The huge benefit to using plists over JSON is that you
This is a super simple and easy way to do this. I would recommend using
Feel free to grab the iPhone Plist Tutorial project source co
You’re probably thinking, “Great, so how do I get my da
I wish. It would be great if more web services offered a plist version of their API. In the new YouVersion API, we will be offering a plist format. Hopefully as the iPhone grows in popularity, this will become more and more common.
If you don’t really have a choice, at least use JSON. Here is
//读plist 文件
iphone-plist-tutorial
uses JSON to transfer everything back and forth from the server and it all works great.
they hit on was using plists to transfer da
method.de>NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOf
NSArray *array = [NSArray arrayWithContentsOfURL:plistURL];de>
provides some great added features, like being asynchronous and handeling HTTP auth, etc.
It’s pretty straight forward. I tried to make it as simple as possible.
Now What?
It takes a PHP array (associative or nonassociative) and converts it into a plist string. You can find it in the helpers folder in
repo.
Anyone Else Doing This?
The next version of
I can’t wait