Starting with iOS 9 I'm receiving a lot of crash reports for NSMetadataQuery crashing at _zapResultArrayIfIdenticalTo:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xc
Crashed Thread: 11
Application Specific Information:
bjc_msgSend() selector name: _zapResultArrayIfIdenticalTo:
Thread 11 Crashed:
0 libobjc.A.dylib 0x34f4faf6 objc_msgSend + 22
1 Foundation 0x2430c459 -[_NSMetadataQueryResultArray release] + 158
2 CoreFoundation 0x2354bffd __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
3 CoreFoundation 0x2354ba0b _CFXRegistrationPost + 396
4 CoreFoundation 0x2354b7e1 ___CFXNotificationPost_block_invoke + 38
5 CoreFoundation 0x2359fac3 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1332
6 CoreFoundation 0x234ad04b _CFXNotificationPost + 484
7 CoreFoundation 0x2354bcf3 CFNotificationCenterPostNotificationWithOptions + 100
8 CloudDocs 0x29a134c3 -[BRQuery _postNote:] + 100
9 Foundation 0x24354a05 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 6
10 Foundation 0x242b64af -[NSBlockOperation main] + 144
11 Foundation 0x242a88bf -[__NSOperationInternal _start:] + 772
12 Foundation 0x24356cc5 __NSOQSchedule_f + 190
13 libdispatch.dylib 0x3564f04f _dispatch_queue_drain + 1760
14 libdispatch.dylib 0x3564802f _dispatch_queue_invoke + 280
15 libdispatch.dylib 0x356503dd _dispatch_root_queue_drain + 398
16 libdispatch.dylib 0x3565024b _dispatch_worker_thread3 + 92
17 libsystem_pthread.dylib 0x357d9e29 _pthread_wqthread + 1022
18 libsystem_pthread.dylib 0x357d9a18 start_wqthread + 6
I process metadata query results on a dedicated queue and make sure to disable updates before accessing results. My code is similar to the ShapeEdit sample app.
After enabling the metadata query again, I still hold on to references to NSMetadataItem results to do further processing (loading thumbnails, updating a table view, etc.). Could this be the problem?
Most of the time, the crash seems to happen shortly after launching the app.