2010-02-24 33 views
5

我週期性地重新編譯運行在我的iPhone上的調試版本的崩潰,涉及UIScrollView,而我的代碼沒有在堆棧幀中。我想知道它是否是我的代碼或Apple的錯誤,並且我無法查詢Apple bug數據庫以查看它是否已被報告。回溯顯示:如何確定UIScrollView崩潰是在我的代碼還是Apple?

#0 0x30218060 in ___forwarding___() 
#1 0x3020eda0 in __forwarding_prep_0___() 
#2 0x309c4ce8 in -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded]() 
#3 0x3025af60 in -[NSObject performSelector:withObject:]() 
#4 0x3098ea94 in -[UIAnimator stopAnimation:]() 
#5 0x3098e5a8 in -[UIAnimator(Static) _advance:]() 
#6 0x3098e460 in LCDHeartbeatCallback() 
#7 0x32047fe8 in HeartbeatVBLCallback() 
#8 0x32a1c3ec in IOMobileFramebufferNotifyFunc() 
#9 0x3188a74c in IODispatchCalloutFromCFMessage() 
#10 0x3020d0b0 in __CFMachPortPerform() 
#11 0x30254a76 in CFRunLoopRunSpecific() 
#12 0x3025416a in CFRunLoopRunInMode() 
#13 0x320452a4 in GSEventRunModal() 
#14 0x308f037c in -[UIApplication _run]() 
#15 0x308eea94 in UIApplicationMain() 
#16 0x0000280c in main (argc=1, argv=0x2ffff58c) at /Users/esilver/Documents/Husband Material/main.m:14 

問題顯然在UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded。 GDB報告:

​​

在MyViewController,我有打電話來滾動的tableView:

[self.tableView scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; 

因爲它是動態的,它顯然是可能的,認爲可以得到滾動之前彈出導航控制器動畫完成。它似乎應該是UIView的工作,當它卸載時取消或等待任何懸而未決的滾動操作。因此,我認爲這是Apple代碼中的一個錯誤。

還是我錯了,而且是有某種檢查我的觀點必須做檢查,如果是滾動前卸貨,還是我完全誤讀了這個崩潰?

FYI,此錯誤也只出現在低存儲器條件REPRO,即我已開始接收didReceiveMemoryWarning回調。

感謝所有,

埃裏克

回答

1

起初,代表應該是weak/assign類型。但在這種情況下,有一個非常普遍的滾動動畫驅動的細微障礙。如果您使用了動畫內容偏移變化爲 您ScrollViews你強烈需要將其代表的dealloc方法設置爲

否則,你將獲得以下

[YourViewController respondsToSelector:]: message sent to deallocated instance 

非常常見的例子:

1. _tableView is ivar of YourViewController 
2. _tableView.delegate = self; 
3. - (void)scrollViewDidScroll:(UIScrollView *)scrollView is implemented at YourViewController 
4. at some point you call [_tableView scrollToRowAtIndexPath:indexPath 
    atScrollPosition:UITableViewScrollPositionBottom animated:YES]; 
    or [_tableView setContentOffset:CGPoint animated:YES] 
    and try to close YourViewController 

的_tableView由CoreAnimation保留,但YourViewController被釋放!

相關問題