0

I would like to convert downloaded string to NSArray. First of all I download data with URLFetcher. After that I need to convert my plist data to nsarray. But could not succeeded.

-(void)urlDidFinish:(UrlFetcher *)urlFetcher withString:(NSString *) responseString {
  NSLog(@"Response: %@", responseString);

  data = [NSArray arrayWithContentsOfFile:responseString];

  [table reloadData];
}
Udo Held
  • 12,314
  • 11
  • 67
  • 93
Volkano
  • 3
  • 1
  • 1

1 Answers1

0

This isn't working because arrayWithContentsOfFile is using the string as a path. In other words, it is expecting responseString to be a file on your computer, not a string that contains the data.

Perhaps you could consider using arrayWithContentsOfURL instead, which might get the data from the URL automatically without having to download it yourself, but I'm not sure due to security restrictions and so on.

You might be interested in this question: Parse Plist (NSString) into NSDictionary

Community
  • 1
  • 1
Gnat
  • 2,861
  • 1
  • 21
  • 30