How does one download or fetch a file using iOS?
I want to fetch a plist file from a ser开发者_运维知识库ver and open it within the app.
Does there need to be a php web client on the server or how would this be done, keeping security in mind to?
NSURL *address = [NSURL URLWithString:@"http://yourwebsite.com/file.plist"];
NSString *fileString = [NSString stringWithContentsOfURL:address];
with this You can fetch file content in a string.
NSURL *address = [NSURL URLWithString:@"http://yourwebsite.com/file.plist"];
NSString *fileString = [NSString stringWithContentsOfURL:address encoding:NSUTF8StringEncoding error:nil];
after fetching you can display this content in UITextView.
[youtextview setText:fileString];
精彩评论