我正在處理我的應用程序的iPad版本,並且遇到了一個奇怪的問題。iPad SearchViewController崩潰_PFArray objectAtIndex超出界限
這裏的應用程序的結構:
UISplitViewController
- > MasterViewController
- > NavigationController
---> TableViewController
----> PrototypeCells
---> SearchDisplayController
- > DetailViewController
- > NavigationController
---> TableViewControlle ř
----> StaticCells
基本上,應用程序被顯示像40個000行與CoreData和fetchResultController上馬西德威。用戶可以使用searchDisplayController搜索項目或使用新的FetchResultController對TableView進行排序。當單擊一行時,didSelectRowAtIndexPath方法在detailView中設置Item。
的問題是,有時當我點擊搜索欄,應用程序崩潰與此錯誤消息:
**Terminating app due to uncaught exception 'NSRangeException',
reason: ' -[_PFArray objectAtIndex:]: index (11) beyond bounds (X)'**
但我想我找到了一個場景,使應用程序崩潰everytimes:
- 應用負載
- 我搜索具有5個或6個字母搜索字符串所以 項由searchViewController返回的量是相當小的(如5 項)。我認爲「越界(X)」對應於這個數量的項目。
- 我取消搜索
- 我的的tableView一個新的FetchResultController
- 我的搜索欄,用途類型排序立即崩潰
如果我做同樣的場景,但與2一個搜索或3個字母,以便searchViewController返回的項目數量更大,沒有崩潰。
此外,應用此場景時,iPhone版本沒有問題/崩潰。
我不明白問題在哪裏,它讓我發瘋。有人想知道哪裏出了問題嗎?我可以更新這篇文章來添加代碼,但現在,我不知道哪個部分是有用的瞭解崩潰。
感謝您的閱讀。