0
所以我正在爲iPhone製作一個非常簡單的RSS閱讀器,但是當我啓動它時,沒有任何項目會與我正在使用的Feed一起顯示。它適用於其他人,但不適用於feeds.feedburner/ParadiseBeats feedburner是否使用與其他Feed不同的系統?我第一次使用的feed是technobuffalo.com/feeds,它可以很好地顯示行中的故事。RSS閱讀器沒有返回Feed
下面是相關代碼:
- (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);
}
}