这是我收到错误的代码:
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
currentElement = [elementName copy];
NSLog(@"didEndElement : %@",currentElement);
if ([currentElement isEqualToString:@"NewDataSet"]) {
[dicEvent setObject:catIDArray forKey:@"term_id"];
[dicEvent setObject:catArray forKey:@"cat_name"];
[dicEvent setObject:catTimgArray forKey:@"thumb_nail_url"];
[dicEvent setObject:catLimgArray forKey:@"large_image_url"];
[xmlData addObject:[dicEvent copy]];
}
}
- (void)parserDidEndDocument:(NSXMLParser *)parser {
if ([catArray count] == 0) {
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:@"Data"
message:@"No record found."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[activityIndicator stopAnimating];
activityIndicator.hidesWhenStopped = YES;
}
else {
NSLog(@"adding category : %@", xmlData);
[tblView reloadData];
}
}
并且当表加载时,我在此方法中遇到错误....它在行 return[xmlData count]; 上给出错误
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"[xmlData count] 2 : %d", [xmlData count]);
return [xmlData count];
}