i am trying to read a txt file and store it in a NSArray. here is my code, but it seems there is something missing that i don’t know!
NSURL *url=[NSURL URLWithString:@"http://www.google.com/robots.txt"];
NSMutableArray *robots=[NSMutableArray arrayWithContentsOfURL:url];
NSLog(@"%@",robots);
You have to load the contents of URL into string first like
Then split this string like this:
Now
parsedarray will contain strings from the URL.Edit:
If you want to filter your array, add this code:
disallowedwill be populated with the strings that containsDisallowstring