开发者

Download a .plist file

Given I uploaded a .plist file to my online website (located at, dunno, www.example.com/data.plist), how do I download that .plist fi开发者_JAVA技巧le to my iPhone application and read it successfully?


NSURL* url = [NSURL URLWithString:@"http://www.example.com/data.plist"];
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:url];


Simplest way is to use the NSDictionary method initWithContentsOfURL: - this will download the plist specified by URL and build a dictionary from it in one go. Be advised it is a blocking call, for other options and how to avoid blocking start with the documentation for initWithContentsOfURL: and explore.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜