There should be no need to parse the result just check for a 200 response code in the - (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response
callback. If it does not exist you should get a 404.
Edit:
I would like to add that pages that do not exist on the Main Wikipedia page (not the mobile .m) do return the correct 404 error code. This could change in the future and may not be completely reliable if they change anything but neither is parsing the content. Here is a sample I put together to prove this.
NSURLRequest *exists = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://en.wikipedia.org/wiki/Qwerty"]];
//Redirects to Blivet
NSURLRequest *redirects = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://en.wikipedia.org/wiki/Poiuyt"]];
NSURLRequest *nonexistant = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://en.wikipedia.org/wiki/Jklfdsa"]];
NSHTTPURLResponse *resp_exists;
NSHTTPURLResponse *resp_redirects;
NSHTTPURLResponse *resp_nonexistant;
[NSURLConnection sendSynchronousRequest:exists returningResponse:&resp_exists error:NULL];
[NSURLConnection sendSynchronousRequest:redirects returningResponse:&resp_redirects error:NULL];
[NSURLConnection sendSynchronousRequest:nonexistant returningResponse:&resp_nonexistant error:NULL];
NSLog(@"\nExists: %d\nRedirects: %d\nNon Existant: %d",
[resp_exists statusCode],
[resp_redirects statusCode],
[resp_nonexistant statusCode] );
And here is the output
Exists: 200
Redirects: 200
Non Existant: 404
So if a page exists or automatically redirects to a page that does exist you will get a 200 error code, if it does not exist then you will get 404. If you would like to capture the redirect you will need implement -connection:willSendRequest:redirectResponse:
and act accordingly.
Note: This example code is synchronous for the sake of being compact. This is not ideal and production implementations should be sending asynchronous request and use the NSURLConectionDelegate
methods.