Hello everyone,
I'm new to Objective C. What I'm trying to do is pull a list from my site that comes out like this:
And using the code below it all comes out on one line when I want it to be split.
Anyone have any ideas how I would go about doing this?
Thanks in advanced.
I'm new to Objective C. What I'm trying to do is pull a list from my site that comes out like this:
Code:
item 1<br>\n
item 2<br>\n
item 3<br>\n
etc<br>\n
And using the code below it all comes out on one line when I want it to be split.
Code:
NSString *theWebString = @"http://mysite.com/getlist.php";
NSURL *theWebURL = [NSURL URLWithString:theWebString];
NSError *error;
NSString *theWebPage = [NSString stringWithContentsOfURL:theWebURL
encoding:NSASCIIStringEncoding
error:&error];
NSArray *lines = [theWebPage componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\r\n"]];
for (NSString* line in lines) {
if (line.length) {
NSLog(@"line: %@", line);
}
Anyone have any ideas how I would go about doing this?
Thanks in advanced.