這裏就是我得到的代碼錯誤:獲得EXC_BAD_ACCESS在我的main.m
-(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];
}
}
當表加載我得到的錯誤在這個方法中....這是給上線返回錯誤[ xmlData count];
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"[xmlData count] 2 : %d", [xmlData count]);
return [xmlData count];
}
請提供的信息在哪裏以及如何定義「XMLDATA」 –
使用NSZombieEnabled-> YES,然後嘗試使用調試 –
啓用殭屍對象,並看到錯誤清楚再告訴我們。轉到產品>編輯方案>啓用殭屍對象 – Saad