开发者

Google News RSS feed returning a didFailWithError -1002 code

I am downloading Google news as an RSS feed. If I view in a browser, everything works fine. But when I try to download as a readable file using the following code I get a "-1002" error. Any ideas?

- (void)viewDidLoad{

[super viewDidLoad];


path = @"feed://news.google.com/news?pz=1&jfkl=true&cf=all&ned=us&hl=en&q=oslo&cf=all&output=rss";
urlRequest = [NSURLReque开发者_开发百科st requestWithURL:[NSURL URLWithString: path]];
urlConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
[urlConnection release];


}

#pragma mark Download RSS

// Start connection and download
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {

NSLog(@"didReceiveResponse");

rssData = [[NSMutableData data] retain];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)dataDownloaded {

NSLog(@"didReceiveData");

[rssData appendData:dataDownloaded];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {

NSString * errorString = [NSString stringWithFormat:@"Error code %i", [error code]];
NSLog(@"error: %@", errorString);

}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {

NSLog(@"connectionDidFinishLoading");

}


Change feed:// to http:// and it will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜