开发者

Download a .plist file

开发者 https://www.devze.com 2023-02-15 05:38 出处:网络
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

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

精彩评论

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