Hi all,
I'm developing an application that uses WKWebView to display a web application which I augment with iOS native utilities such as Speech to Text and IAP. The application also uses Service workers, so we define AppBound Domains in the info.plist file.
Everything works for this, but when we deploy on a device the application will crash and say we need these entitlements
com.apple.developer.web-browser-engine.networking,
com.apple.developer.web-browser-engine.rendering,
com.apple.developer.web-browser-engine.webcontent,
com.apple.runningboard.assertions.webkit
From what I can see, we do need all of them. However Apple suggest submitting a request to be an Altnerative Browser (https://developer.apple.com/support/alternative-browser-engines)
This is not appropriate for the application in my view since one requirement of being an alternative browser is that you don't modify the resources on the web site - we of course do since we inject javascript in order to bridge between iOS and the contents of the webview.
How are people navigating this issue? I assumed it would be common given the use of Tauri etc. to build similar types of applications, but I don't see much about it.
Thank you!
WebKit
RSS for tagDisplay web content in windows and implement browser features using WebKit.
Posts under WebKit tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi Apple Devs & WebKit Team,
We operate https://outdoorgala.com — a verified, HTTPS-secure Canadian ecommerce site focused on elite outdoor safety gear. We're Indigenous-owned, based in Alberta, and take customer trust and compliance seriously.
However, Safari (iOS + macOS) is falsely flagging our site as “deceptive,” preventing customers from accessing us — even though:
We use GoDaddy Website Builder with no redirections or malware
All product links are clean, HTTPS-secure, and tracked ethically
We recently implemented a fully compliant cookie banner (Accept/Decline logic)
A public security.txt and OpenPGP key has been published: https://outdoorgala.com/security
No phishing, malware, or cloaking behavior exists on the site
We’ve already submitted a review via:
➡️ https://websitereview.apple.com
And filed a bug report via Feedback Assistant (FB17608544)
What else can be done to speed up review or get flagged domains unblocked in Safari? This is hurting our business and blocking consumer access — despite following all Apple guidelines.
Would appreciate any insights or escalation tips.
Thank you!
– Derek Eiteneier
Founder, Outdoor Gala
I am trying to record the requests and responses in a WKWebView, but instruments does not seem to record them. Is this to be expected?
The webView is set to inspectable, and I am using the HTTP Traffic instrument.
All the requests the app is doing are recorded, but neither the original request for the webView, nor subsequent traffic is recorded.
When I use Safari to inspect the webView, all I see is the last page (even when I start the inspector before the first request is made).
How can I see these requests?
Dears,
We are facing some issue in ios 18.4.1. Recently some of our end users who updated their ios devices to 18.4.1 have experienced random 403 errors in runtime. as per our analysis, We identified that these errors are associated with "CSRF token mismatch".
After successful login, the user's CSRF token is causing issue and it was changed in runtime, this causes the cookie mismatch, and the users is getting 403 errors, and the user session is getting invalid suddenly.
let me know if anyone facing the same issue in ios 18.4.1 and let me know Is there any workaround for this issue.
Thanks.
Is ServiceWorker supported on WKWebView? As per Mozilla Developer Network(MDN Web) docs[1] its not supported, but our research shows that ServiceWorker becomes available for a domain in WKWebView 1) if the domain is allowlisted in app-bound domains[2] or 2) if app is registered as default browser(this can not be considered for our app as its not a browser).
How to enable ServiceWorker on WKWebView? Is adding domain as app-bound domain the right/only way to enable ServiceWorker on WKWebView? We didn't find any official documentation about this.
Can WebView get ServiceWorker support by default without enabling app bound domains since that is not an option for our app? Our app needs to support more than 10 domains. Powerful APIs such as JavaScript injection, cookie manipulation, event handlers are by default available to all domains/WebView instances even if App doesn't enable app-bound domains. Is it possible to do same for ServiceWorker?
If ServiceWorker can not be supported by default then can Apple provide a feature by which ServiceWorker will be enabled in App for all the domains?
Apple enforces maximum of 10 app-bound domains. Is it possible to remove this limit and provide a way to dynamically add to this list at the time of a request?
[1] https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker#browser_compatibility
[2] https://webkit.org/blog/10882/app-bound-domains/
In our project, we download H5 resources to the local device and then open the H5 pages through WKWebView(-loadFileURL:allowingReadAccessToURL:). When the H5 pages request server resources, cookies are required.
Before opening the H5 page, we set the required cookies in the WKHTTPCookieStore using the setCookie method. Additionally, we set the allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs properties for the WebView.
On other mobile phones, the cookies can be carried normally. However, on mobile phones running the iOS 18.0 system, the cookies cannot be carried. Moreover, this problem only emerged after we upgraded Xcode to version 16.2.
We've also tried injecting cookies via JavaScript, but it didn't work(document.cookie = xx=${xx}; path=/; expires=weekday, xx jan xxxx xx:xx:xx GMT; Domain=example.com; Secure; SameSite=None ;).
Can anyone help me on this?
Thanks in advance.
Hi, we were recently approved for the com.apple.developer.web-browser.public-key-credential entitlement and have added it to our app. It initially worked as expected for a couple of days, but then it stopped working. We're now seeing the same error as before adding the entitlement:
Told not to present authorization sheet: Error Domain=com.apple.AuthenticationServicesCore.AuthorizationError Code=1 "(null)"
ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "(null)"
Do you have any insights into what might be causing this issue?
Thank you!
Hello everyone,
In my application, i have implemented authentication using ASWebauthenticationSession. However, when redirecting the user to a WKWebView, no cookies are shared, causing the session to be lost and requiring the user to log in again.
Is there a way to share cookies between the two? If not, what would be the best approach to set up authentication that ensures SSO when switching to a WebView ?
Thank you very much for your help !
Our app is an enterprise app via MDM.
We are experiencing an issue in iPadOS 18.4 when loading an internal HTTPS server via WKWebView in a hybrid iOS app.
Our server uses a self-signed certificate but lacks the digitalSignature usage in its Key Usage extension. (Currently we have no chance to change the server's certificate)
We override webView:didReceiveAuthenticationChallenge:completionHandler: to trust the certificate:
completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
This "completionHandler" works in previous 18.3.2 , but not work in 18.4. May I know is there any changes in 18.4 for the https certification? Why this delegate not work? What we can do to ignore this ssl error and get connection?
Thanks in advance, look forward for your reply.
We are experiencing a compatibility issue with our hybrid app related to the recent update in iPadOS 18.4, specifically concerning HTTPS connections.
What are the key changes introduced in iPadOS 18.4 regarding HTTPS connections? Our app previously managed to bypass the DigitalSignature key usage missing error in the self-signed server certificate within the didReceiveAuthenticationChallenge method, as documented here: https://developer.apple.com/documentation/webkit/wknavigationdelegate/webview(_:didreceive:completionhandler:) . However, since the update to iPadOS 18.4, this method is no longer being called, resulting in direct failure of HTTPS connections.
We are using cordova-ios 7.1.
Thanks in advance for your help.
Hi all,
I'm currently working with WKWebView and implementing the WKNavigationDelegate protocol. In particular, I'm trying to inspect the sourceFrame of a WKNavigationAction to make navigation policy decisions based on the frame's URL path.
Here's the relevant Swift code inside decidePolicyFor:
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) {
// ...
let sourceFrame: WKFrameInfo = navigationAction.sourceFrame
let request: URLRequest = sourceFrame.request // <- SIGABRT occurs here
// ...
}
The issue is that the app crashes with a SIGABRT at runtime when attempting to access sourceFrame.request. According to Swift's type system, neither sourceFrame nor its request property are optional, so at first glance this seems safe. However, the crash report suggests otherwise.
From the crash log, it appears that the issue arises during the bridging from Objective-C to Swift:
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x00000001a127a030 in static Foundation.URLRequest._unconditionallyBridgeFromObjectiveC(Swift.Optional<__C.NSURLRequest>) -> Foundation.URLRequest ()
#1 0x00000001056c48b0 in CustomWebViewController.webView(_:decidePolicyFor:preferences:decisionHandler:)
#2 0x00000001056c4c78 in @objc CustomWebViewController.webView(_:decidePolicyFor:preferences:decisionHandler:) ()
#3 0x00000001b8c66e0c in WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction ()
#4 0x00000001b8fd14dc in WebKit::WebPageProxy::decidePolicyForNavigationAction ()
#5 0x00000001b8fcfc7c in WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared ()
#6 0x00000001b8fcfb18 in WebKit::WebPageProxy::decidePolicyForNavigationActionAsync ()
#7 0x00000001b87ddaa0 in WebKit::WebPageProxy::didReceiveMessage ()
#8 0x00000001b869f474 in IPC::MessageReceiverMap::dispatchMessage ()
#9 0x00000001b878dda4 in WebKit::WebProcessProxy::dispatchMessage ()
#10 0x00000001b878d614 in WebKit::WebProcessProxy::didReceiveMessage ()
#11 0x00000001b869e7e4 in IPC::Connection::dispatchMessage ()
#12 0x00000001b869e358 in IPC::Connection::dispatchIncomingMessages ()
#13 0x00000001b9a96a44 in WTF::RunLoop::performWork ()
#14 0x00000001b9a96688 in WTF::RunLoop::performWork ()
#15 0x00000001a2428b9c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#16 0x00000001a24289b4 in __CFRunLoopDoSource0 ()
#17 0x00000001a2428810 in __CFRunLoopDoSources0 ()
#18 0x00000001a2429190 in __CFRunLoopRun ()
#19 0x00000001a242ad4c in CFRunLoopRunSpecific ()
#20 0x00000001ef705454 in GSEventRunModal ()
#21 0x00000001a4e45890 in -[UIApplication _run] ()
#22 0x00000001a4e10cec in UIApplicationMain ()
#23 0x00000001a4ef261c in ___lldb_unnamed_symbol275689 ()
#24 0x00000001059a5104 in static UIApplicationDelegate.main() ()
#25 0x00000001059a5074 in static AppDelegate.$main() ()
#26 0x00000001059a82ec in main ()
#27 0x00000001c940af0c in start ()
This implies that while Swift treats sourceFrame.request as non-optional, the underlying Objective-C implementation may actually return nil—leading to a crash when the non-optional Swift type attempts to force unwrap it.
My question:
Is there a way to safely access navigationAction.sourceFrame.request —- or determine if it’s nil—before Swift attempts the implicit bridging from Objective-C? Or is there an established workaround for safely inspecting this property?
Any guidance or best practices for avoiding this crash would be greatly appreciated!
Thanks in advance.
Xcode16.2 加 iOS18 以上的系统加载图片 http 类型的 url 时, http 链接会自动升级为 https,请问有处理方案吗?浏览器报错信息如下:This content was automatically upgraded and should be served over HTTPS.
Xcode16.2+iOS18以上的系统,加载图片http类型的url时,会自动升级为https,下面是Safari自动打印的日志:This content was automatically upgraded and should be served over HTTPS.有什么解决方案吗?
I build app success full, but app is crash when it's install and start on simulator, please help to resolve the issue.
xcode version 16.3
dyld`__abort_with_payload:
Thread 1: signal SIGABRT
Console error log:
dyld[27267]: Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs
Referenced from: <9ED011A5-B4BE-3B0B-98C6-0AFAF76A5B6C> ..../Library/Developer/CoreSimulator/Devices/C94520D8-031D-4D91-8050-859E0951D1A6/data/Containers/Bundle/Application/522BF7A2-7633-4FF1-BA02-130727B8E65C/App.app/Frameworks/flutter_inappwebview_ios.framework/flutter_inappwebview_ios
Expected in: <0085D0EC-09E4-3699-ACE9-9B0C20B090BB> /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit
Symbol not found: _$sSo18WKPDFConfigurationC6WebKitE4rectSo6CGRectVSgvs
Referenced from: <9ED011A5-B4BE-3B0B-98C6-0AFAF76A5B6C> ..../Library/Developer/CoreSimulator/Devices/C94520D8-031D-4D91-8050-859E0951D1A6/data/Containers/Bundle/Application/522BF7A2-7633-4FF1-BA02-130727B8E65C/App.app/Frameworks/flutter_inappwebview_ios.framework/flutter_inappwebview_ios
Expected in: <0085D0EC-09E4-3699-ACE9-9B0C20B090BB> /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit
dyld config: DYLD_SHARED_CACHE_DIR=.../Library/Developer/CoreSimulator/Caches/dyld/24D81/com.apple.CoreSimulator.SimRuntime.iOS-18-2.22C150 DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=...../Library/Developer/Xcode/DerivedData/App-fdpvmjxapalesmhcoroqmpqwlxxm/Build/Products/Debug-iphonesimulator:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libLogRedirect.dylib:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=.....Library/Developer/Xcode/DerivedData/App-fdpvmjxapalesmhcoroqmpqwlxxm/Build/Products/Debug-iphonesimulator DYLD_FALLBACK_FRAMEWORK_PATH=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks DYLD_FALLBACK_LIBRARY_PATH=/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib
I’ve been working on a personal iOS project for fun — essentially a YouTube music player, learning how background media playback works in native iOS apps.
After seeing that Musi (a famous music streaming app) can play YouTube audio in the background with the screen off — I got really curious. I’ve been trying to replicate that basic background audio functionality for YouTube embeds using WKWebView. I've spent a crazy amount of time (probably 20 hours) trying to figure this out but have achieved no success.
Here’s what I’ve tried so far:
-Embedding a YouTube video in a WKWebView
-Activating AVAudioSession with .playback and setting .setActive(true)
-Adding the UIBackgroundModes key with audio in Info.plist
-Adding the NSAppTransportSecurity key to allow arbitrary loads
--Testing on a real device (iPhone 14, iOS 18.1 target)--
What happens:
Audio plays fine in the foreground.
If I exit the app and go to the lock screen quickly enough (less than 3 seconds) after pressing play, I can resume playback briefly from the lock screen — but it doesn’t automatically continue like in Musi and other apps like it.
Most of the time, the audio stops when the app is backgrounded.
I get this error consistently in the logs:
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)"
It seems like the app lacks some specific entitlements related to WebKit media playback. I don’t have AppDelegate/SceneDelegate (using SwiftUI), but can add if needed.
I’m super curious how music streaming apps using youtube as a source get around this — are they doing something different under the hood? A custom player? A SafariViewController trick? Is there a specific way to configure WKWebView to keep playing in the background, or is this a known limitation?
Would really appreciate any insight from folks who’ve explored this before or know how apps like Musi pulled it off.
Thanks in advance!
Howdy,
WKWebView feature request: allow Fullscreen API without User Gestures
similar to ElectronJS' userGesture: true flag that allows devs to bypass user gesture restriction for Fullscreen API and similar
executeJavaScript(code[, userGesture])
https://www.electronjs.org/docs/latest/api/web-contents#contentsexecutejavascriptcode-usergesture
afaik this is allowed because of a fairly recent update to Chromium that also allows users to give Fullscreen API permissions per domain
https://chromeos.dev/en/posts/using-the-fullscreen-api-without-gestures
Would be greatly useful for a use case in my cross-platform app, so I can avoid rewriting all platforms to use Chromium
Thanks
We are currently implementing the payment flow, and for handling payment details — including card entry and validation — we are utilizing a WKWebView. The webview securely loads the payment provider’s page, ensuring sensitive information such as card numbers are entered and validated directly within the web context.
I’d like to clarify that this change has not yet been released to Production. As part of a feature enhancement to our existing payment flow, we are transitioning to a new payment vendor, SnapPay.
While trying to load the SnapPay URL embedded within an iFrame in our iOS app, I observed the following error in the Xcode console. While this error may be generic, I wanted to highlight it:
825a18 - [pageProxyID=7, webPageID=8, PID=67346] WebPageProxy::didFailLoadForFrame: frameID=24, isMainFrame=0, domain=NSURLErrorDomain, code=-999
Upon investigating, we compared the headers from our existing payment URL and SnapPay's URL, and found that SnapPay includes the following Content-Security-Policy (CSP) header:
Content-Security-Policy: frame-ancestors ...
"Content-Security-Policy" value="default-src 'self'; script-src 'self' https://hcaptcha.com https://.hcaptcha.com https://code.jquery.com https://www.gstatic.com https://code.jquery.com/jquery-3.3.1.min.js https://test.lightbox.cardx.com/v1/lightbox.min.js https://www.ssa.gov/accessibility/andi/ https://c.evidon.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' https://hcaptcha.com https://.hcaptcha.com https://fonts.googleapis.com/css https://stage.snappayglobal.com/Resource/ https://www.ssa.gov/accessibility/andi/andi.css 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' *.googleapis.com *.gstatic.com ; connect-src 'self' https://demo1.cditechnology.com https:; form-action https://hcaptcha.com https: 'self' *.ipg-online.com secure.bluepay.com https://test.api.lightbox.cardx.com https://3ds-acs.test.modirum.com/ https://demo1.cditechnology.com/; frame-ancestors https://snappaydirect-perf.fiserv.com 'self' file: https: http; frame-src .snappayglobal.com 'self' https://hcaptcha.com https://.hcaptcha.com https: https://www.google.com .ipg-online.com secure.bluepay.com https://.cardconnect.com https://test.api.lightbox.cardx.com/ https://test.lightbox.cardx.com https://paywithcardx.com/payment/auth.cgi securepayments.cardpointe.com *.cardpointe.com https://3ds-acs.test.modirum.com/ https://www.yokohamatire.com http://uat1-txt.ad.portal.texas.gov https://uat1-txt.ad.portal.texas.gov "
After multiple working sessions with the SnapPay team, we were able to confirm that when they disable CSP or remove the frame-ancestors directive, the iFrame loads successfully within our app. However, SnapPay cannot change on their CSP.
To enable the iFrame to load in the iOS app, we added the following line of code:
webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs").
This resolved the issue with loading the iFrame. Note: the file being loaded is a local .html file,.
Before submitting this update to the App Store, I’d like to confirm whether this usage of allowFileAccessFromFileURLs is acceptable for App Store review.
I wanted to confirm that with this change is there a security concern for WKWebview?
The application I'm currently working on uses WebKit. Based on the crash analytics, we have noticed that some of our users are experiencing an unusual behavior in the app's WebKit view with macOS 15.3.2. These errors are reported for this version of the OS. The error in the crash log is a SIGABRT error, but there is no relevant information available to address it. In some crash logs, we found this error: "NSInternalInconsistencyException: Returned WKWebView was not created with the given configuration" but there is not any particular way to address it. Is there a way to identify the cause of this error? Alternatively, has anyone encountered this issue and found a solution?
OS Version: macOS 15.3.2 (24D81)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0
Application Specific Information:
Returned WKWebView was not created with the given configuration.
Thread 0 Crashed:
0 CoreFoundation 0x303111e74 __exceptionPreprocess
1 libobjc.A.dylib 0x3027b6cd4 objc_exception_throw
2 CoreFoundation 0x303111d6c +[NSException raise:format:]
3 WebKit 0x34e85cb20 WebKit::UIDelegate::UIClient::createNewPage
4 WebKit 0x34e8a4a80 WebKit::SOAuthorizationCoordinator::tryAuthorize
5 WebKit 0x34e9f04f8 WebKit::WebPageProxy::createNewPage
6 WebKit 0x34ef994c8 WebKit::WebPageProxy::didReceiveSyncMessage
7 WebKit 0x34f0830cc IPC::MessageReceiverMap::dispatchSyncMessage
8 WebKit 0x34ea753b0 WebKit::WebProcessProxy::didReceiveSyncMessage
9 WebKit 0x34f07cfb4 IPC::Connection::dispatchSyncMessage
10 WebKit 0x34f07d3b0 IPC::Connection::dispatchMessage
11 WebKit 0x34f078c50 IPC::Connection::SyncMessageState::ConnectionAndIncomingMessage::dispatch
12 WebKit 0x34f07f4f4 ***::Detail::CallableWrapper<T>::call
13 JavaScriptCore 0x33f3520c0 ***::RunLoop::performWork
14 JavaScriptCore 0x33f352fe8 ***::RunLoop::performWork
15 CoreFoundation 0x30309f8a0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
16 CoreFoundation 0x30309f834 __CFRunLoopDoSource0
17 CoreFoundation 0x30309f598 __CFRunLoopDoSources0
18 CoreFoundation 0x30309e134 __CFRunLoopRun
19 CoreFoundation 0x30309d730 CFRunLoopRunSpecific
20 HIToolbox 0x319aeb52c RunCurrentEventLoopInMode
21 HIToolbox 0x319af1344 ReceiveNextEventCommon
22 HIToolbox 0x319af1504 _BlockUntilNextEventMatchingListInModeWithFilter
23 AppKit 0x30a7cd844 _DPSNextEvent
24 AppKit 0x30b133c20 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
25 AppKit 0x30a7c0870 -[NSApplication run]
26 AppKit 0x30a797064 NSApplicationMain
27 <unknown> 0x182780274 <redacted>
Thread 0 name: t-main-ui Crashed:
0 CoreFoundation 0x303111e74 __exceptionPreprocess
1 libobjc.A.dylib 0x3027b6cd4 objc_exception_throw
2 CoreFoundation 0x303111d6c +[NSException raise:format:]
3 WebKit 0x34e85cb20 WebKit::UIDelegate::UIClient::createNewPage
4 WebKit 0x34e8a4a80 WebKit::SOAuthorizationCoordinator::tryAuthorize
5 WebKit 0x34e9f04f8 WebKit::WebPageProxy::createNewPage
6 WebKit 0x34ef994c8 WebKit::WebPageProxy::didReceiveSyncMessage
7 WebKit 0x34f0830cc IPC::MessageReceiverMap::dispatchSyncMessage
8 WebKit 0x34ea753b0 WebKit::WebProcessProxy::didReceiveSyncMessage
9 WebKit 0x34f07cfb4 IPC::Connection::dispatchSyncMessage
10 WebKit 0x34f07d3b0 IPC::Connection::dispatchMessage
11 WebKit 0x34f078c50 IPC::Connection::SyncMessageState::ConnectionAndIncomingMessage::dispatch
12 WebKit 0x34f07f4f4 ***::Detail::CallableWrapper<T>::call
If I use the method callAsyncJavaScript() my app will compile, but it won't run on older simulators.
Specifically, in a brand new Storyboard project, I added this to `viewDidLoad():
let webView = WKWebView()
webView.callAsyncJavaScript("1", in: nil, in: .page) { result in
print("\(result)")
}
This runs fine with Xcode 16.3 targeting the iOS 18.4 simulator. It doesn't work if I target the iOS 18.3.1 simulator or the iOS 17.5 simulator. It does work on an iPhone 15 Pro running iOS 18.4 and it works on an iPhone 12 Pro running iOS 17.7.1.
It goes without saying that this used to work on Xcode 16.2 and earlier, since my real project has been using that API for 3 or 4 years now.
The specific error is
dyld[89984]: Symbol not found: _$sSo9WKWebViewC6WebKitE19callAsyncJavaScript_9arguments2inAF17completionHandlerySS_SDySSypGSo11WKFrameInfoCSgSo14WKContentWorldCys6ResultOyyps5Error_pGcSgtF
Referenced from: <82CC68A8-9426-343E-82CD-5443F53A6919> /Users/dave/Library/Developer/CoreSimulator/Devices/69CE58A3-8162-4616-B110-5857E6E2889F/data/Containers/Bundle/Application/3F27AAA0-8E96-437D-A1F4-DECD2E1A95B5/CallAsyncJavascript.app/CallAsyncJavascript.debug.dylib
Expected in: <E11EC0F5-2AD1-3402-AB03-31A85EA6EB3A> /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit
Xcode16.3 SwiftUI Preview Library not loaded: /usr/lib/swift/libswiftWebKit.dylib
Untitled.rtf