Hi!
My SwiftUI app is a rather complex browser app. Starting with iOS 18, the app crashes due to repeted reloads of the WkWebView. I’ve tracked the issue as far as I can, but I still haven’t found the root cause.
My app is structured like this:
MainView holds a cuple of subviews. It also holds a @StateObject called viewModel that holds a lot of @Published vars. The viewModel is passed as a enivormentObject.
Example from ViewModel:
@MainActor class ViewModel: NSObject, ObservableObject {
@Published public var isLoading: Bool = false
@Published public var loadProgress: Double? = 0
public func setIsLoading(_ value: Bool) async {
self.isLoading = value
}
public func setLoadProgress(_ value: Double?) async {
self.loadProgress = value
}
}
WebView is a subview of MainView, which holds a navigation bar, and a UIViewRepresentable, which is a WkWebView.
The WkWebView pushes some states to the ViewModel as the underlying values of the WkWebView changes, i.e. estimaedProgress, and isLoading. This is done via KVO and works like this:
estimatedProgressObservation = self.parent.webView.observe(\.estimatedProgress) { webView, progress in
Task {
await parent.viewModel.setLoadProgress(webView.estimatedProgress)
}
}
isLoadingObservation = self.parent.webView.observe(\.isLoading) { webView, value in
Task {
await parent.viewModel.setIsLoading(webView.isLoading)
}
}
By using a timer in WkWebViews Coordinator, i trigger a load after a configurable amount of time :
func loadUrl(url: URL) {
DispatchQueue.main.async {
console.info("Load URL: ...", sensitive: "Load URL: \(url.absoluteString)")
let policy: NSURLRequest.CachePolicy
if self.parent.settings.noCache {
policy = .reloadIgnoringLocalAndRemoteCacheData
} else {
policy = .useProtocolCachePolicy
}
let request = URLRequest(url: url, cachePolicy: policy)
self.parent.webView.load(request)
}
}
Running the app with the automatic reload enabled freezes the app after a couple of hours. It also seems to freeze Safari on the device. The device needs to be rebooted.
If I inspect the device's running processes, hundreds of ”com.apple.webkit. web content " processes are running.
Removing await parent.viewModel.setLoadProgress(webView.estimatedProgress) and await parent.viewModel.setIsLoading(webView.isLoading) fixes the issue, but it is necessary for other app functions. Therefore, is suspect that the viewModel somehow causes the bug.
The issue arises after a couple of loads 5-10. The debugger shows a message when the processes start to pile up. I suspect its related.
Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12d0e7f60 {Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.terminateprocess, NSLocalizedFailureReason=Client not entitled, RBSPermanent=true}}}
How can I find out what causes the suspected memory leak? Instruments gives me nothing of value. The memory leak wasn't present in iOS 17. Is this a bug in iOS 18, or was something intentionally changed?
General
RSS for tagExplore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
**Description: **
We have implemented a process to launch a native app from a browser (Safari) via universal links. However, under certain conditions, the app does not launch seamlessly, and an error page is displayed in the browser. In such cases, a button to open the app appears at the top of the error page, and pressing this button successfully opens the app.
The error page is a blank white page with only the following error message displayed: "NoSuchKeyThe specified key does not exist."
We want to confirm the detailed specifications and conditions of the behavior where seamless transition via universal links fails.
If there are means to suppress or control the occurrence of this issue, please let us know.
Configuration:
OS: iOS 18.1
Device: iPad 9th generation, 10th generation
**Reproduction Steps: **
When attempting to launch the app via a universal link, a pop-up appears asking "Do you want to allow this page to open ?"
If 'Cancel' is pressed in this pop-up, the issue occurs the next time the app is launched via a universal link.
However, we have also confirmed that this issue can occur due to operations other than this one, and we have not been able to pinpoint the conditions under which it occurs. Therefore, we would like to confirm the detailed specifications and conditions leading to the occurrence of this issue.
iOS 18.4 introduces the new WKWebExtension API to support extensions in WKWebView. However, for extensions that have migrated to Manifest V3 and use an extension service worker as the background script, it's currently not possible to inspect them through Safari.
This is only thing I can see, I don't know how to inspect the details of the "background.js"
I'm wondering—has this changed? Is it now possible to inspect extension service workers?
Hi, I am developing the Click & Read web add-on for Chromium, Firefox and Safari. We use xcrun safari-web-extension-converter tool to generate the Safari add-on, with up-to-date MacBook MacOS, Xcode et Safari : Sequoia 15.3.2, Safari Version 18.3.1 (20620.2.4.11.6), XCode Version 16.0 (16A242d).
We have updated our addon to Manifest v3, having the Background script as Server Worker
"background": {
"service_worker": "background.js",
"type": "module"
}
self.addEventListener("activate", (event) => {
console.info("Service Worker activated", event);
event.waitUntil(
self.registration.pushManager
.subscribe({
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(
process.env.VAPID_PUBLIC_KEY
),
})
.then(async (subscription) => {
console.info("[Service Worker] Extension is subscribed to push");
const { subscription: savedSubscription } =
await getLocalStorageKeyData("subscription");
if (savedSubscription)
fetchApi({
url: `${API_SERVER_URL}/subscription/remove/${savedSubscription.keys.auth}`,
}); // Remove previous subscription from server on addon activate
currentBrowser.storage.local.set({
subscription: subscription.toJSON(),
}); // Save subscription in local storage
currentBrowser.runtime.setUninstallURL(
`${API_SERVER_URL}/subscription/remove/${
subscription.toJSON().keys.auth
}`
); // Set uninstall URL to remove notification subscription on addon uninstall
fetchApi({
url: `${API_SERVER_URL}/subscription`,
reqInit: {
body: JSON.stringify(subscription.toJSON()),
method: "POST",
headers: {
"Content-Type": "application/json",
},
},
});
})
.catch((error) => {
console.error("Push subscribe error: ", error);
}) // Subscribe to push notifications
);
});
When trying to subscribe the addon instance to our Push server, we get this error : Push subscribe error: NotAllowedError: User denied push permission
Our NodeJS backend is using the web-push librabry : https://github.com/web-push-libs/web-push) to save subscriptions and make notifications push.
By looking for same errors on forums, the best hint I found is that it could be related to the testing is done on localhost (addon is built from XCode onto Safari, and Push server is running on localhost).
Thanks for your help !
I want to confirm the specifications and behavior of Safari.
We have a system built on Microsoft Azure that uses Azure AD B2C for authentication.
When we logging in, there is a phone authentication feature where a call is made to the registered phone number.
However, this phone authentication does not work properly only on iPhone's Safari. The specific situation is listed below:
When performing phone authentication on iPhone's Safari, a call is made from Azure AD B2C, and pressing the # button on the Safari screen can be done. But then, it transitions to an error screen.
We tried multiple iPhone devices and multiple iOS versions, but the result was the same.
But when accessing the system on a PC, and performing phone authentication, it works without any errors.
Also when we use browsers other than Safari (for example, Google Chrome and Firefox) on the iPhone, the phone authentication works without any errors, too.
Even with Safari, if the device displaying the login screen and the device making the call are different, phone authentication works without any errors, too.(it fails if they are the same device).
We reached out Microsoft about this issue, and they responded that:
The Azure resource called FrontDoor at the front end of Azure AD B2C supports the HTTP/2 protocol, and HTTP/2 protocol is used in communication with Safari.
In Safari's HTTP/2 communication, when a call is received while the screen is displayed, a reset packet is sent to the web server (in this case, the web server is FrontDoor).
This interrupts the session, causing a session termination error on the Azure AD B2C side, and phone authentication fails.
Therefore, we would like to ask you the following two points:
In HTTP/2 communication, does the Safari browser send a reset packet to the web server when it receives a phone call?
If so, what is the cause of this behavior? And are there any measures to prevent the reset packet from being sent?
Topic:
Safari & Web
SubTopic:
General
Hi there, we have found a problem, after switching audio tracks multi times when play the HLS, there will be a few seconds of no sound playing after audio track switching, Is there a solution to this problem?
I have a Safari extension that plays audio via the javascript AudioContext API. It was working fine under iOS 17 and is now broken under iOS 18. It does not play audio at all.
I've tried in both the iOS 18 public beta and the iOS 18.1 developer beta. It is broken in both of them.
I've also created Feedback item FB15170620 which has a url attached to a page I created which demonstrates the issue.
input type="file"でアップロードした画像データからGPS情報が除去されます。
こちらはiPadOS16.5.1で発生しておりました。
iPadOS17.4.1、iPadOS18.3では正常にGPS情報が保持されます。
iOS、iPadOSのアップデートでGPS情報を保持するよう修正されたと見受けられますが、リリースノートを参照しても上記修正についての記事を見つけられませんでした。
お手数ですが、上記修正に該当する記事をご教示頂けませんでしょうか。
どうぞよろしくお願い致します。
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!
I want use the Safari Extension to decorate the window.fetch function, But No matter how I try, I can't get the fetch function to execute correctly. I was going through the documentation: https://developer.apple.com/documentation/safariservices/using-injected-style-sheets-and-scripts
and found this sentence:
"Injected scripts have an implied namespace — you don’t have to worry about your variable or function names conflicting with those of the website author, nor can a website author call functions in your extension. In other words, injected scripts and scripts that you include in the webpage run in isolated worlds, with no access to each other’s functions or data."
Does this mean I can't modify the window object in the content script just like a Chrome extension does with the webpage?
BTW, In chrome I use chrome.scripting.executeScript API, and in
plasmo I just use world: "MAIN" content script's config to achieved this feature.
Hi everyone,
I’m working on a web project developed on Adobe Experience Manager (AEM), where we’ve built a custom component that embeds Apple Podcasts episodes using the official iframe provided via https://embed.podcasts.apple.com.
Everything works correctly from a rendering point of view, but we are now exploring ways to track user interactions with the embedded player, specifically events such as: start, play, pause,
progress milestones (e.g. 25%, 50%, etc.).
This data would be used to send analytics events to Adobe Analytics.
So far, we haven’t found any documentation or JavaScript API that would allow us to listen to these events.
We'd like to ask:
Is there any official way to track playback events from an Apple Podcasts iframe?
Any information, clarification, or direction would be really appreciated.
Thanks in advance!
Thanks,
Adriana
Topic:
Safari & Web
SubTopic:
General
We are building a Safari web extension utilising native messaging, to send messages to the Swift native part of the app. We sometimes experience, that the beginRequest handler is executed multiple times, at the same time.
We have a special part of the code in the handler, that must be run only once. Because it uses NS defaults storage, and also because it calls our servers. We have tried to use a serial dispatch queue, as well as other locking and mutex techniques, to no success.
We suspect that the instances of the handler are isolated in a way, that these locks don’t work (maybe they don’t share memory?). But we are not sure. When looking at os_logs from the handlers, they all share the same PID.
Has anyone experienced anything similar and can shed some light on what's going on?
We confirmed a problem at Safari on iPadOS 18.2 or after version.
For confirmation, we made a HTML document (see below HTML1) what include ‘method="POST" target="_blank"’ and tested the form however server received GET method and there is no parameter, server did not receive “id” parameter.
We confirmed that fact in captured packet and log file that on the server.
HTML1:
We also made another HTML document (see below HTML2) what include submit button, but the server received GET method as above.
HTML2:
And we also confirmed that it behaves differently depending on the network environment.
If the form targets a name that does not exist (ex. target=” A12345”), behaves differently http or https.
http:
Safari opened new tag, but the server received GET method. Normally, Safari open new tag and the server receive POST method.
https:
Safari opened new tag, and the server received POST method. It is normally.
If the form targets ‘_blank’, the server received GET method on http or https both.
We think Safari change the method POST to GET and delete parameters.
It is not conformed to the HTML specification if is that true.
We confirmed it was not happened at Safari on iPadOS 17.4, and Windows PC (Edge, Chrome).
The method what the server received is POST.
We find same problem in Apple Support Community (see below URL).
https://discussionsjapan.apple.com/thread/255987615 (Described in Japanese)
Is it a bug in Safari on iPadOS 18.2 or after version?
Do you have plan to fix? Or if fixed the bug, when do you release fixed version.
Topic:
Safari & Web
SubTopic:
General
After updating to iOS 18.4, our web application (with service workers) crashes on devices that accessed it prior to the update. This issue also affects hybrid mobile apps using the same web application; reinstalling the app resolves it by refetching and reinstalling service workers. Debugging is challenging because clearing the cache or reinstalling the app fixes the problem, and no useful error logs are available. Has anyone encountered similar crashes related to service workers after an iOS update and have any insights into the cause?
I am encountering an issue where we are unable to run or launch Safari Driver in our automation tests using macOS. When attempting to run safaridriver -p 8888 from the terminal, we receive the following error message:
ERROR: safaridriver could not launch because it is not configured correctly or you need to authenticate. Re-run safaridriver(1) and pass the '--enable' flag to configure and/or authenticate.
For more information, consult the safaridriver(1) man page.
Despite running sudo safaridriver --enable as an administrator (even as root), the issue persists.
I’ve searched through various online forums and GitHub repositories but couldn’t find a working solution. Some references are:
Apple Developer Forum Thread: https://forums.developer.apple.com/forums/thread/762321
GitHub Issue: https://github.com/SeleniumHQ/selenium/issues/11381
I have an endpoint that generates a .ics file. From my mobile app, I open the browser (Safari) and retrieve the .ics file. In Safari, the events are displayed as expected, and I can use the "Add All" button to add them to the calendar. After clicking "Add All," I can select the desired calendar, and the events are successfully added (see screenshots 1 and 2 below).
Here’s the initial .ics file response:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:NAME
BEGIN:VEVENT
DTSTAMP:20250101T195917Z
DTSTART:20250102T131600
DTEND:20250102T142500
SUMMARY:My Event 1
UID:unique-uid1
LAST-MODIFIED:20250101T155715Z
DESCRIPTION:Description
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20250101T195917Z
DTSTART:20250103T131600
DTEND:20250103T135600
SUMMARY:My Event 2
UID:unique-uid2
LAST-MODIFIED:20250101T155715Z
DESCRIPTION:Description
SEQUENCE:1
END:VEVENT
END:VCALENDAR
Later, I updated the .ics file with new event details:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:NAME
BEGIN:VEVENT
DTSTAMP:20250102T195917Z
DTSTART:20250104T131600
DTEND:20250104T142500
SUMMARY:My Event 1 Update
UID:unique-uid1
LAST-MODIFIED:20250104T155715Z
DESCRIPTION:Description
SEQUENCE:2
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20250102T195917Z
DTSTART:20250105T131600
DTEND:20250105T142500
SUMMARY:My Event 2 Update
UID:unique-uid2
LAST-MODIFIED:20250102T155715Z
DESCRIPTION:Description
SEQUENCE:2
END:VEVENT
END:VCALENDAR
I updated everything according to the iCalendar documentation:
UID remained unchanged
SEQUENCE has been updated
DTSTAMP has been updated
LAST-MODIFIED has been updated
However it seems like that Safari can't handle updates on events.
In the preview we can see the changes, but when I click on "Add All" button, nothing happens.
The same behavior is working with other calendars like Outlook (web view) or Google Calendar.
My Questions:
Is there a property missing from my .ics file that is necessary for iOS Safari to handle updates?
Is Safari not designed to handle event updates in this way?
Should I consider moving to a subscription-based solution to manage updates more reliably?
Any insights or suggestions would be greatly appreciated!
我使用Apple Pay on the Web Interactive Demo构建了一个web应用使用的是Payment Request API方式,但是遇到了几个问题:
拉起的web Apple Pay 底部一直转圈圈无法付款,这个是什么问题?
如何设置sandbox测试付款呢?
如何异步、同步获取支付结果(后端代码获取支付结果)?demo只有await response.complete("success");前端代码获取支付结果的操作
demo网址: https://shop.wowseer.com/rsolomakhin/pr/applepay/
I am currently developing an app using WKWebView.
In iOS 17, Apple introduced ProxyConfiguration, and I have two questions regarding its usage:
Is there a way to use ProxyConfiguration to distinguish between HTTP and HTTPS traffic?
I have reviewed the documentation but couldn’t find a clear method for this.
As an alternative approach, I am attempting to determine the request scheme within WKWebView and switch proxyConfigurations just before loading the request.
My current implementation sends requests to hoge_a by default and switches to hoge_b only for HTTP traffic.
if #available(iOS 17.0, *) {
if URLString.contains("http:") {
webView.configuration.websiteDataStore.proxyConfigurations = [hoge_b]
}
}
webView.load(request)
if #available(iOS 17.0, *) {
if URLString.contains("http:") {
webView.configuration.websiteDataStore.proxyConfigurations = [hoge_a]
}
}
2. Since I modify proxyConfigurations every time webView.load(request) is called, are there any potential issues or concerns with this approach?
I would appreciate any insights you may have on either of these questions.
Hello Apple Developer Team,
I would love to see iCloud Keychain Autofill and Touch ID support extended to Chromium-based browsers on macOS (such as Ecosia, Brave, or Vivaldi).
Currently, Safari allows autofill of passwords using Touch ID, but when using other browsers, I have to manually copy-paste credentials from Keychain Access, which is time-consuming.
Would it be possible for Apple to provide an API or framework that allows non-WebKit browsers to integrate iCloud Keychain autofill while keeping security intact?
This feature would make macOS more convenient for users who prefer alternative browsers while keeping security standards high.
Thanks in advance for considering this!
Best regards, Kilian
Hi,
We have a native application with a webview part.
When we open the app, we load webview resources in a false foreground. The webview communicates with the native part to query local variables, among other things. We have noticed that for the past few weeks, when the biometric component is presented to enter the fingerprint or faceId, while the component is displayed, the webview does not respond.
We do not see the calls made by the webview, nor can we respond to them. Even if you open the Safari debugger, the webview does not respond UNTIL you close the biometric component in the native part.
This has created a big problem in our app, and we wanted to know if it is an issue you had on your radar.
Thank you very much.