gpt4 book ai didi

iphone - Google新闻RSS供稿返回didFailWithError -1002代码

转载 作者:行者123 更新时间:2023-12-03 08:35:54 26 4
gpt4 key购买 nike

我正在将Google新闻作为RSS源下载。如果在浏览器中查看,一切正常。但是,当我尝试使用以下代码下载为可读文件时,出现“-1002”错误。有任何想法吗?

- (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 = [NSURLRequest 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");

}

最佳答案

将feed://更改为http://即可。

关于iphone - Google新闻RSS供稿返回didFailWithError -1002代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6796788/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com