I have a servlet that serves up a plist XML file. What's the best way to slup this into an NSDictionary
? I have this basically working with:
NSDictionary* dict = [ [ NSDictionary alloc] initWithContentsOfURL:
[NSURL URLWithString: @"http://example.com/blah"] ];
But then I have no control over the timeout; I'd rather not have my UI hang for 60 seconds just because the server (which I may not control) is having a hissy fit. I know about NSURLRequest
, which will let me do the following:
NSURLRequest *theRequest=[NSURLRequest requestWithURL:
[NSURL URLWithString: @"http://example.com/blah"
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:5 ];
But I don't quite see how to feed that to NSDictionary.