I built a simple demo app that implements the code that Apple provides here for instantiating an WKWebView.
https://developer.apple.com/documentation/webkit/wkwebview
This code causes a crash when launched from Xcode but I don't seem to have a problem if I run the installed app directly from the simulator.
Has anyone else run into this issue while testing iOS 15? Are there new considerations that I need take into account when migrating my app to support iOS 15?
I'm running Xcode version 13.0 beta 5 (13A5212g).
Thank you!
Here's the backtrace:
* thread #7, queue = 'com.apple.root.default-qos', stop reason = EXC_BREAKPOINT (code=1, subcode=0x10058c530)
* frame #0: 0x000000010058c530 libdispatch.dylib`_dispatch_sema4_timedwait.cold.3 + 36
frame #1: 0x0000000100555f84 libdispatch.dylib`_dispatch_sema4_timedwait + 128
frame #2: 0x0000000100556508 libdispatch.dylib`_dispatch_semaphore_wait_slow + 72
frame #3: 0x0000000196af2a0c MediaAccessibility`_copyResultPreferenceXPCCall(__CFString const*, bool, void const*, bool*) + 236
frame #4: 0x0000000196af1ea8 MediaAccessibility`MAPreferencesCopyProfileValue + 136
frame #5: 0x0000000196af20a0 MediaAccessibility`MAPreferencesCopyProfileValueWithExpectedType + 28
frame #6: 0x0000000196aefcc8 MediaAccessibility`MACaptionAppearancePrefCopyPreferredLanguages + 40
frame #7: 0x0000000196aeb990 MediaAccessibility`MACaptionAppearanceCopySelectedLanguages + 32
frame #8: 0x000000018af971c0 WebCore`WebCore::CaptionUserPreferencesMediaAF::platformPreferredLanguages() + 40
frame #9: 0x000000018921c244 WebKit`invocation function for block in WebKit::WebProcessPool::setMediaAccessibilityPreferences(WebKit::WebProcessProxy&) + 36
frame #10: 0x0000000100554028 libdispatch.dylib`_dispatch_call_block_and_release + 24
frame #11: 0x0000000100555828 libdispatch.dylib`_dispatch_client_callout + 16
frame #12: 0x0000000100558118 libdispatch.dylib`_dispatch_queue_override_invoke + 960
frame #13: 0x0000000100567d24 libdispatch.dylib`_dispatch_root_queue_drain + 432
frame #14: 0x0000000100568814 libdispatch.dylib`_dispatch_worker_thread2 + 188
frame #15: 0x00000001c80effec libsystem_pthread.dylib`_pthread_wqthread + 212
This is not a problem with WKWebView. It's a general issue with dispatch semaphores in the current beta of iOS 15. It's acknowledged as a known issue under Debugging in the release notes of iOS 15.
See: https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-15-beta-release-notes
Under Debugging > Known issues
Using dispatch semaphores in an iOS app running in a device simulator on a Mac with Apple silicon running macOS 11 will cause the app to crash. (81783378)
There is also a workaround for this issue:
Workaround: In Xcode, select Product > Scheme > Edit Scheme, then deselect Run > Options > Queue Debugging > “Enable backtrace recording.”
This workaround is working and solved this problem for me. I can now work with the simulator again. I need to have a closer look at the release notes in the future to spot this issues earlier.