开发者

Use an external text file to populate a UILabel

I want to populate a UILabel with a string made from a txt file, I've read many posts 开发者_StackOverflowon here and most talk about it being in the Resources file using [NSBundle], but I want it to come from a an external server, like below, but the string is always null.

  NSString *filePath = @"http://mydomain.com/textfile.txt";  
  NSString *string = [NSString stringWithContentsOfFile:filePath encoding:NSASCIIStringEncoding error:NULL]; 
  NSLog(@"string = %@", string); // is (null)


I think you can parse the filePath to URL and use stringWithContentOfUrl

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜