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 

Comments

搜尋

本月熱門文章

[社會觀察] 一生順遂與命途乖舛

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

水電行介紹---台北市大同區重慶北路二段101號的永發水電行---公車直達的水電行!

好久不見的 羽生亞里沙也開始認真健身了

日本旅行 去東京可以在哪邊買羽球相關用品?WEMBLEY/WINDSOR/梭家/Victoria/Alpen TOKYO/

吉的堡教育集團創辦人是王國安但是現在的董事長是白松易

什麼是 OTA ?

[專案管理] 敏捷提到的"資訊散熱器"(Information Radiator)是甚麼?

Agoda

熱門文章

[社會觀察] 一生順遂與命途乖舛

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

中華民國2024 總統、副總統選舉公告發布 連署參選門檻28萬9667人 可以推薦候選人的政黨包括民進黨、國民黨、民眾黨和時力

日本旅行 去東京可以在哪邊買羽球相關用品?WEMBLEY/WINDSOR/梭家/Victoria/Alpen TOKYO/

[HMD Global] Nokia 2020 新手機發布 首款 5G 手機 Nokia 8.3 預計夏季開賣 !

[FAANG面試] 如何準備Google Technical Program Manager (TPM) 面試

關於中國:202X年

[表特][Passion Sisters] 中信兄弟PS女孩 浮誇甜心 凱蒂 炸裂全場~ 小許瑋甯

[音樂] 霖霖 新單曲:給你了

[棒球] 2023 台灣大賽G5 威能帝13K飆破紀錄 猿3轟搶聽牌優勢