私はいくつかのデータをサーバーから取得中に以下のエラーが発生しました。データをフェッチしている間、アクティビティインジケータ付きのカスタムアラートビューを表示します。アラートはメインスレッドを使用し、データフェッチはNSThreadによって行われます。この問題は、常にではなく、しばらくの間しか発生しません。私は何をすべきか理解できません。アプリケーションが終了しました - キャッチされない例外 'NSGenericException'、
*キャッチされない例外により 'NSGenericException'、理由にアプリを終了:
* '列挙されながら*コレクションが変異した( ""、 ""、 "" )'。最初のスローでのコールスタック: (
0 CoreFoundation 0x00f2abe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0107f5c2 objc_exception_throw + 47
2 CoreFoundation 0x00f2a6a9 __NSFastEnumerationMutationHandler + 377
3 UIKit 0x00371b8e -[UIView(Hierarchy) _findFirstSubviewWantingToBecomeFirstResponder] + 189
4 UIKit 0x00366a13 -[UIView(Hierarchy) _promoteDescendantToFirstResponderIfNecessary] + 42
5 MyApplnName 0x00015154 -[SecondViewController getDataFromServer] + 1798
6 Foundation 0x000a1d4c -[NSThread main] + 81
7 Foundation 0x000a1cd8 __NSThread__main__ + 1387
8 libSystem.B.dylib 0x928db7fd _pthread_start + 345
9 libSystem.B.dylib 0x928db682 thread_start + 34
)
は、削除または一部を追加するあなたは、例えば、for-loop
(for (id _obj in object)
)を使用してNSMutableArray
またはNSMutableSet
を、いくつかのobject
を列挙「NSException」
を:あなたのコードでありますあなたは 'foreach item in collection'のようなことをやっていると同時にループ本体のコレクションを変更しますか? – Ankur
コードを表示してください。 – macbirdie