Thursday, September 6, 2012

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


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 

No comments:

Post a Comment

發表一下意見,互動一下唄!

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Adventure Book 2.0 Headline Animator

GoogleAd

funP Android 相關文章