私は最初のiPhoneアプリを作成していて、困惑しています。
RSSリーダーを作成しようとしていますが、craigslistからのフィードを使用しようとしています。このコードは、stackoverflowを使用して、「ステータスコード: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];
}
すべては順調です。しかし、フィードを「http://portland.craigslist.org/muc/」に変更すると、ステータスコードは404になります。
足りないものはありますか?CraigslistはiPhoneのウェブサイトへのアクセスを禁止していますか?URLで実行する必要のあるエスケープはありますか?
クレイグリストのURLを含むコードはこちらです。これは私が使用しているものとまったく同じで、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];
}