我得到這個錯誤:請幫助爲什麼我的應用程序崩潰,出現以下錯誤:?
[NSIndexPath row]: message sent to deallocated instance 0x13135d50
我的代碼:
-(void) scrollViewDidFinishScrolling: (UIScrollView*) scrollView {
CGPoint point = [self convertPoint:CGPointMake(self.frame.size.width/2.0, kDefaultCellHeight/2.0) toView:self.tableView];
NSIndexPath* centerIndexPath = [self.tableView indexPathForRowAtPoint:point];
[self.tableView selectRowAtIndexPath: centerIndexPath
animated: YES
scrollPosition: UITableViewScrollPositionTop];
if (centerIndexPath.row != self.currentIndex.row) {
//Hide the arrow when scrolling
[self setCurrentIndex:centerIndexPath];
}
[self.arrow show:YES];
'self.currentIndex'必須被釋放,你如何聲明/創建它? – 2013-04-25 21:11:35
您可以在調試器中重複該問題嗎? – 2013-04-25 21:12:14
消息說明。您在不再指向有效對象的指針上調用「行」。據推測問題指針是currentIndex,可能的原因是它沒有妥善保留。但是你需要運行分析儀並進行一些調試來確定它。 – 2013-04-25 21:12:25