BGTaskScheduler blocks when build with Xcode 11.2


Gerriet M. Denkmann
 

I have an iOS app (iOS 12.4+) which did work on iOS 12.4 … iOS 13.2 when build with Xcode 11.1.

Now I have upgraded to Xcode 11.2 and the app no longer works on iOS 13.2 devices.

When I do:
BGTaskScheduler.shared.cancelAllTaskRequests()
it does not return.
lldb tells me:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x00000001919b4634 libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x00000001919b3aa0 libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000103b5b55c libdispatch.dylib`_dispatch_mach_send_and_wait_for_reply + 564
frame #3: 0x0000000103b5b924 libdispatch.dylib`dispatch_mach_send_with_result_and_wait_for_reply + 52
frame #4: 0x00000001917aa440 libxpc.dylib`xpc_connection_send_message_with_reply_sync + 236
frame #5: 0x00000001920c7b9c Foundation`__NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__ + 12
frame #6: 0x0000000191ea1074 Foundation`-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 2608
frame #7: 0x0000000191ea045c Foundation`-[NSXPCConnection _sendSelector:withProxy:arg1:] + 124
frame #8: 0x00000001920ce890 Foundation`_NSXPCDistantObjectSimpleMessageSend1 + 36
frame #9: 0x00000001a496ca48 DuetActivityScheduler`-[_DASScheduler cancelAllTaskRequests] + 176
frame #10: 0x00000001ba2e5f1c BackgroundTasks`-[BGTaskScheduler cancelAllTaskRequests] + 152

What to do?

Gerriet.