EXC_BAD_ACCESS in BfTask.m
This error occurs while running a project incorporating the Bolts framework compiled with bitcode on Xcode 9.4.1. The project is being run on device and the launch screen of the app even comes up, and then it crashes with the error in the title.
This is the relevant code snippet
BOOL completed; @synchronized(self.lock) { completed = self.completed; if (!completed) { [self.callbacks addObject:[^{ [executor execute:executionBlock]; } copy]]; } } if (completed) { [executor execute:executionBlock]; }
the exception is being thrown by the line:
[executor execute:executionBlock];
The stack trace is:
MyProject was compiled with optimization - stepping may behave oddly; variables may not be available.
- thread #5, queue = 'com.parse.asynctaskqueue.sync', stop reason = EXC_BAD_ACCESS (code=2, address=0x117ea8640)
frame #0: 0x0000000117ea8640
- frame #1: 0x0000000100c012c8 MyProject
-[BFTask continueWithExecutor:block:cancellationToken:](self=0x0000000117ea9690, _cmd=<unavailable>, executor=0x0000000117ea8df0, block=0x0000000100bd9a74, cancellationToken=<unavailable>) at BFTask.m:368 [opt] frame #2: 0x0000000100b8d1b8 MyProject
__28-[PFAsyncTaskQueue enqueue:]_block_invoke(.block_descriptor=0x000000011990b920) at PFAsyncTaskQueue.m:50 [opt] frame #3: 0x0000000101ff11dc libdispatch.dylib_dispatch_call_block_and_release + 24 frame #4: 0x0000000101ff119c libdispatch.dylib
_dispatch_client_callout + 16 frame #5: 0x0000000101fffdfc libdispatch.dylib_dispatch_queue_serial_drain + 768 frame #6: 0x0000000101ff46ac libdispatch.dylib
_dispatch_queue_invoke + 328 frame #7: 0x0000000102000d54 libdispatch.dylib_dispatch_root_queue_drain_deferred_wlh + 352 frame #8: 0x0000000102007e38 libdispatch.dylib
_dispatch_workloop_worker_thread + 676 frame #9: 0x0000000182ef7e70 libsystem_pthread.dylib_pthread_wqthread + 860 frame #10: 0x0000000182ef7b08 libsystem_pthread.dylib
start_wqthread + 4
- frame #1: 0x0000000100c012c8 MyProject