0

所以我正在为 iPhone 制作一个非常简单的 RSS 阅读器,但是当我启动它时,没有任何项目出现在我正在使用的提要中。它适用于其他人,但不适用于 feeds.feedburner/ParadiseBeats feedburner 是否使用与其他 feed 不同的系统?我第一次使用的提要是 technobuffalo.com/feeds,它可以很好地按行显示故事。

以下是相关代码:

 - (void)viewDidAppear:(BOOL)animated
 {
[super viewDidAppear:animated];
if ([stories count] == 0) {
    NSString *path = @"http://feeds.feedburner.com/ParadiseBeats";
    [self parseXMLFileAtURL:path];
}
}

和元素解析...

 -(void)parser:(NSXMLParser *) parser didStartElement:(NSString *) elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *__strong)qName attributes:(NSDictionary *__strong)attributeDict {

currentElement = [elementName copy];
if([elementName isEqualToString:@"item"]){
    //clear out story item caches...
    item = [[NSMutableDictionary alloc] init];
    currentTitle = [[NSMutableString alloc] init];
    currentDate = [[NSMutableString alloc] init];
    currentSummary = [[NSMutableString alloc] init];
    currentLink = [[NSMutableString alloc] init];

}

}

 -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *__strong)elementName namespaceURI:(NSString *__strong)namespaceURI qualifiedName:(NSString *__strong)qName {

if ([elementName isEqualToString:@"item"]) {
    [item setObject:currentTitle forKey:@"title"];
    [item setObject:currentLink forKey:@"link"];
    [item setObject:currentSummary forKey:@"summary"];
    [item setObject:currentDate forKey:@"date"];

    [stories addObject:[item copy]];
    NSLog(@"adding story: %@", currentTitle);
}


 }
4

1 回答 1

1

您提到的提要可能具有不同的属性,因为它的 rss 最终不会用提到的代码解析。

我对其他提要也有同样的问题,尽管有些提要工作正常。

于 2011-11-24T05:34:13.663 回答