iPhoneアプリのXMLファイルを読み込んでいるときにエラーが発生しました。 iPhoneアプリにRSSフィードを読み込む新機能があります。すべてがうまく見えますが、私はこの問題があります:rss iphone/ipadアプリを読み取る
rssをロード中にエラーが発生しました。あなたのインターネット接続
を確認してくださいここに私のコードです:
- (BOOL) readRSS {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
BOOL success = NO;
NSXMLParser *parser = nil;
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://rss.domain.com/%@.xml", self.currentPage]];
parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];
[parser setShouldResolveExternalEntities:NO];
success = [parser parse];
[parser release];
[pool drain];
return success;
}
その後、私はこのコードを持っている:
- (void) cleartbl:(NSInteger)type {
[[[self rssParser] rssItems] removeAllObjects];
[_tableView reloadData];
if(type == 1) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"RSS Feed"
message:@"Error while loading rss. Please check your Internet connection."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
}
、私は割り当てる:
if([elementName isEqualToString:@"title"]){
self.currentItem.title = self.currentItemValue;
}
私の問題は何ですか、私は何かを欠いている?
すべてのrssでエラーが発生しますか? –
@BookOfZeusはい – Gabriel