iOS exception - Collection was mutated while being enumerated
iOS exception - Collection was mutated while being enumerated
some related discuss
issue sample1
Before you loop over the array, you can create a new array with the elements. So when the original looped array is mutated (either by you, or by its owner) the array you loop over stays intact.
issue sample2
some related discuss
issue sample1
Before you loop over the array, you can create a new array with the elements. So when the original looped array is mutated (either by you, or by its owner) the array you loop over stays intact.
issue sample2
The error occurs because you are adding new objects to termsArray within the for loop
- Create a new empty array (e.g.newTermsArray)
- In the first loop create and add these new items to newTermsArray
- Then you will need a second loop to add the items from newTermsArray back into the original termsArray
@synchronized (yourobject)
{
//do something with your object
}
and for how to analyze Call Stack Symbols, you need to know iOS crash report
留言
張貼留言
發表一下意見,互動一下唄!