My app is crashing and I suspect it is from MKMapView
I am using an MKMapView in my application. I want to link the user to Apple Maps.
The user may want to use Apple Maps, so I allow them to click a button, and when tapped it calls the following:
Approximately 80% of the time I call this, I am seeing a crash:
This is the stack trace
I am using an MKMapView in my application. I want to link the user to Apple Maps.
The user may want to use Apple Maps, so I allow them to click a button, and when tapped it calls the following:
Code Block var url = URLComponents(string: "https://maps.apple.com") let queryItems = URLQueryItem(name: "q", value: place.name) url?.queryItems = [queryItems] UIApplication.shared.open(url!.url!.absoluteURL)
Approximately 80% of the time I call this, I am seeing a crash:
Code Block libc++abi: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
This is the stack trace
Code Block Thread 1 Queue : com.apple.main-thread (serial) #0 0x00000001be057734 in __semwait_signal () #1 0x00000001993dba34 in nanosleep () #2 0x00000001993db8f8 in usleep () #3 0x00000001932cb684 in CABackingStoreCollectBlocking () #4 0x0000000192cc0ab0 in __35-[UIWindowScene _prepareForSuspend]_block_invoke () #5 0x000000019208c7cc in -[_UIContextBinder purgeContextsWithPurgeAction:] () #6 0x0000000192cc0a38 in -[UIWindowScene _prepareForSuspend] () #7 0x0000000191ec6490 in -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] () #8 0x0000000191ec74c8 in -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] () #9 0x0000000192537b5c in -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] () #10 0x000000019f5baeb8 in -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] () #11 0x000000019f5e74f0 in __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 () #12 0x000000019f5c96a4 in -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] () #13 0x000000019f5e741c in __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke () #14 0x0000000101105d90 in _dispatch_client_callout () #15 0x000000010110981c in _dispatch_block_invoke_direct () #16 0x000000019f60dfa0 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ () #17 0x000000019f60dc30 in -[FBSSerialQueue _targetQueue_performNextIfPossible] () #18 0x000000019f60e184 in -[FBSSerialQueue _performNextFromRunLoopSource] () #19 0x000000018ffd8848 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ () #20 0x000000018ffd8744 in __CFRunLoopDoSource0 () #21 0x000000018ffd7a48 in __CFRunLoopDoSources0 () #22 0x000000018ffd1a28 in __CFRunLoopRun () #23 0x000000018ffd11c0 in CFRunLoopRunSpecific () #24 0x00000001a75b9734 in GSEventRunModal () #25 0x0000000192a3f7e4 in -[UIApplication _run] () #26 0x0000000192a45054 in UIApplicationMain () #27 0x000000010095d2f8 in main at /Users/ZXX/Developer/ZXZZ/AppLogic/AppDelegate.swift:14 #28 0x000000018fc8dcf8 in start () Thread 3#0 0x00000001dba81744 in start_wqthread () com.apple.uikit.eventfetch-thread (5)#0 0x00000001be0324fc in mach_msg_trap () #1 0x00000001be031884 in mach_msg () #2 0x000000018ffd7d10 in __CFRunLoopServiceMachPort () #3 0x000000018ffd1bb0 in __CFRunLoopRun () #4 0x000000018ffd11c0 in CFRunLoopRunSpecific () #5 0x00000001912b1fac in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] () #6 0x00000001912b1e78 in -[NSRunLoop(NSRunLoop) runUntilDate:] () #7 0x0000000192af438c in -[UIEventFetcher threadMain] () #8 0x00000001914232fc in __NSThread__start__ () #9 0x00000001dba78c00 in _pthread_start () Thread 6#0 0x00000001dba81744 in start_wqthread () Thread 11#0 0x00000001dba81744 in start_wqthread () com.apple.NSURLConnectionLoader (12)#0 0x00000001be0324fc in mach_msg_trap () #1 0x00000001be031884 in mach_msg () #2 0x000000018ffd7d10 in __CFRunLoopServiceMachPort () #3 0x000000018ffd1bb0 in __CFRunLoopRun () #4 0x000000018ffd11c0 in CFRunLoopRunSpecific () #5 0x00000001908aa4b8 in ___lldb_unnamed_symbol11592$$CFNetwork () #6 0x00000001914232fc in __NSThread__start__ () #7 0x00000001dba78c00 in _pthread_start () Thread 14#0 0x00000001dba81744 in start_wqthread () AVAudioSession Notify Thread (15)#0 0x00000001be0324fc in mach_msg_trap () #1 0x00000001be031884 in mach_msg () #2 0x000000018ffd7d10 in __CFRunLoopServiceMachPort () #3 0x000000018ffd1bb0 in __CFRunLoopRun () #4 0x000000018ffd11c0 in CFRunLoopRunSpecific () #5 0x0000000197a4df20 in GenericRunLoopThread::Entry(void*) () #6 0x0000000197a500d8 in CAPThread::Entry(CAPThread*) () #7 0x00000001dba78c00 in _pthread_start () Thread 16#0 0x00000001dba81744 in start_wqthread () Thread 17#0 0x00000001dba81744 in start_wqthread () Thread 18 Queue : com.Metal.CompletionQueueDispatch (serial) #0 0x00000001be057334 in __pthread_kill () #1 0x00000001dba79aa0 in pthread_kill () #2 0x00000001993deb90 in abort () #3 0x00000001a4bbebb8 in abort_message () #4 0x00000001a4bafeb0 in demangling_terminate_handler() () #5 0x00000001a4abc06c in _objc_terminate() () #6 0x00000001a4bbdfa0 in std::__terminate(void (*)()) () #7 0x00000001a4bbdf2c in std::terminate() () #8 0x00000001a4add91c in objc_terminate () #9 0x0000000101105e70 in _dispatch_client_callout4 () #10 0x0000000101123318 in _dispatch_mach_msg_invoke () #11 0x000000010110dcbc in _dispatch_lane_serial_drain () #12 0x000000010112431c in _dispatch_mach_invoke () #13 0x000000010110dcbc in _dispatch_lane_serial_drain () #14 0x000000010110ecf8 in _dispatch_lane_invoke () #15 0x000000010110dcbc in _dispatch_lane_serial_drain () #16 0x000000010110ecc4 in _dispatch_lane_invoke () #17 0x000000010111ba00 in _dispatch_workloop_worker_thread () #18 0x00000001dba7a7a4 in _pthread_wqthread ()