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 

留言

Google Search

推薦內容橫式

本月熱門文章

什麼是 OTA ?

SISTAR - 孝琳HYOLYN 生日快樂

Taiwan Baseball CPBL Uni-President Lions quick guide

CRO (Crypto .com) 申請推薦碼 kpvtnqfy27 推薦功能 定期定額買幣

如何在QNAP NAS上連動Apple HomeKit ? A: 安裝 HomeBridge !

熱情的開發者 QNAPClub 快速導入第三方軟體市集 !!

KaoJane愛情設計 粉絲見面會

Coinbase是甚麼? 可以用來做什麼?

這個網誌中的熱門文章

Android應用開發豆知識:利用 adb 安裝 apk 到裝置上

Android 中文輸入法 官方版 ! Gboard - Google 鍵盤 開始支援注音輸入啦

Google Play 推薦Android app 誠徵App排行榜

北京故宮首訪,一窺清宮秘史 大玉兒 & 甄嬛

[家教][社會觀察] 建中教我的事 沒上建中被父母親折磨? 在建中到底是如何 ...

[FAANG面試] Amazon/AWS 領導力準則 14 Amazon Leadership Principles

[品質控制] 什麼是Sanity test ? 軟體測試常見名詞整理 包含不同部門的測試人員負責範圍

Acer ICONIA Smart S300 更新後越來越好 Acer也有出手機?!

新鮮人找工作:職場名詞解釋 AE FAE Pre-sales Post-sales