Saturn
Saturn

Reputation: 18149

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 file to my iPhone application and read it successfully?

Upvotes: 0

Views: 2848

Answers (2)

CRD
CRD

Reputation: 53000

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.

Upvotes: 0

gcamp
gcamp

Reputation: 14662

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

Upvotes: 2

Related Questions