I'm building my first iPhone app and I'm stymied.
I'm trying to build an RSS reader, and I'm trying to use a feed from craigslist. This code, using stackoverflow, returns "Status code: 200":
- (void)parseRSSFeed:(NSString *)feed withDelegate:(id)delegate
{
responseData = [[NSMutableData data] retain];
feed = @"http://stackoverflow.com";
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:feed]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
NSLog(@"status code: %d", [((NSHTTPURLResponse*) response) statusCode]);
[responseData setLength:0];
}
All is well. But if I change feed to, say, "http://portland.craigslist.org/muc/", I get a status code of 404.
Is there anything I'm missing? Does Craigslist disallow iPhone access to its website? Is there some escaping I need to do on the URL?
The code, with the craigslist URL, is here. This is exactly as I'm using it, and it returns a 404:
- (void)parseRSSFeed:(NSString *)feed withDelegate:(id)delegate
{
responseData = [[NSMutableData data] retain];
feed = @"http://portland.craigslist.org/muc/";
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:feed]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}