Vivek Sinha
Vivek Sinha

Reputation: 1586

Collection <__NSCFDictionary: 0x15a2fae0> was mutated while being enumerated

I am getting this error sometimes in my apps. I printed object and got this:

(lldb) po 0x15a2fae0
{
    "0x15d8bcd0.posErrorMarker{id: 4558}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15d8baf0.posErrorMarker{id: 4554}" = <00007b43 00000000 0000f03f>;
    "0x15d8aad0.negError{id: 4525}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15a3f620.marker{id: 4353}" = <00007b43 00000000 0000f03f>;
    "0x15d8bab0.posErrorMarker{id: 4552}" = <00007b43 00000000 0000f03f>;
    "0x15d8ad10.posErrorMarker{id: 4526}" = <00007b43 00000000 0000f03f>;
    "0x15d8b300:UIView-Encapsulated-Layout-Height.marker{id: 4567}" = <00803b44 00000000 0000f0bf>;
    "0x15d8b3f0.posErrorMarker{id: 4541}" = <00007b43 00000000 0000f03f>;
    "0x15d89a80.negError{id: 4563}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15a3f5f0.marker{id: 4351}" = <00803b44 00000000 0000f0bf>;
    "0x15d8baf0.negError{id: 4555}" = <00803b44 00000000 0000f03f>;
    "0x15d8b880.negError{id: 4551}" = <00803b44 00000000 0000f03f>;
    "0x15d86b60.posErrorMarker{id: 4546}" = <00007b43 00000000 0000f03f>;
    "0x15d8ad50.negError{id: 4529}" = <00803b44 00000000 0000f03f>;
    "0x15a3f4a0.marker{id: 4333}" = <00803b44 00000000 0000f03f>;
    "0x1590d210.posErrorMarker{id: 4539}" = <00007b43 00000000 0000f03f>;
    "0x15d8a900.posErrorMarker{id: 4516}" = <00007b43 00000000 0000f03f>;
    "0x15d8b880.posErrorMarker{id: 4550}" = <00007b43 00000000 0000f03f>;
    "0x15a3f590.marker{id: 4346}" = <00007b43 00000000 0000f03f>;
    "0x15a43eb0.marker{id: 4324}" = <00803b44 00000000 0000f03f>;
    "0x15a43ee0.marker{id: 4326}" = <00803b44 00000000 0000f03f>;
    "0x15d8aea0.negError{id: 4535}" = <00803b44 00000000 0000f03f>;
    "0x15d8b030.posErrorMarker{id: 4536}" = <00007b43 00000000 0000f03f>;
    "0x15d8a900.negError{id: 4517}" = <00803b44 00000000 0000f03f>;
    "0x15a3f560.marker{id: 4343}" = <00007b43 00000000 0000f03f>;
    "0x15d89a00.negError{id: 4561}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15d8a8b0.posErrorMarker{id: 4514}" = <00007b43 00000000 0000f03f>;
    "0x15d8b840.posErrorMarker{id: 4548}" = <00007b43 00000000 0000f03f>;
    "0x15d8b2d0:UIView-Encapsulated-Layout-Width.marker{id: 4564}" = <00803b44 00000000 000000c0>;
    "0x15d8bc90.posErrorMarker{id: 4556}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15d86b60.negError{id: 4547}" = <00803b44 00000000 0000f03f>;
    "0x15a3f650.marker{id: 4355}" = <00007b43 00000000 0000f03f>;
    "0x15d8a8b0.negError{id: 4515}" = <00803b44 00000000 0000f03f>;
    "0x15d8b840.negError{id: 4549}" = <00403b44 00000000 0000f03f>;
    "0x15d8b3f0.negError{id: 4542}" = <00803b44 00000000 0000f03f>;
    "0x1590d210.negError{id: 4540}" = <00803b44 00000000 0000f03f>;
    "0x15a43f10.marker{id: 4329}" = <00803b44 00000000 0000f03f>;
    "0x15d8a980.negError{id: 4523}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15d89f00.posErrorMarker{id: 4498}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15a3f530.marker{id: 4340}" = <00007b43 00000000 0000f03f>;
    "0x15d8ad50.posErrorMarker{id: 4528}" = <00007b43 00000000 0000f03f>;
    "0x15d8ad10.negError{id: 4527}" = <00803b44 00000000 0000f03f>;
    "0x15d8a3f0.posErrorMarker{id: 4506}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15d8b030.negError{id: 4537}" = <00803b44 00000000 0000f03f>;
    "0x15d8a440.negError{id: 4509}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
    "0x15d8b650.negError{id: 4545}" = <00803b44 00000000 0000f03f>;
    "0x15a43f40.marker{id: 4332}" = <00803b44 00000000 0000f03f>;
    "0x15d8b650.posErrorMarker{id: 4544}" = <00007b43 00000000 0000f03f>;
    "0x15a43e50.marker{id: 4319}" = <00803b44 00000000 0000f03f>;
    "0x15d8bab0.negError{id: 4553}" = <00803b44 00000000 0000f03f>;
    "0x15a3f5c0.marker{id: 4349}" = <00803b44 00000000 0000f0bf>;
    "0x15d8aea0.posErrorMarker{id: 4534}" = <00007b43 00000000 0000f03f>;
    "0x15d89f40.posErrorMarker{id: 4500}" = <00803b44 00000000 0000f03f 00007b43 00000000 0000f03f>;
}

Is there any help on this?

Upvotes: 0

Views: 447

Answers (1)

Denis Vert
Denis Vert

Reputation: 366

Most probably you change your collection during iteration. To avoid crash you can copy keys and iterate with them as shown in this post or use methods suggested by apple. I think the simplest method is to copy collection before iterate.

Upvotes: 2

Related Questions