Hello,
I am currently developing a game streaming application using ReplayKit and Broadcast Upload Extension. I would like to ask for your assistance regarding capturing snapshots of a WKWebView in the upload extension without adding it to a visible view hierarchy.
From my understanding, calling takeSnapshot(with:) on a WKWebView that is not added to the view hierarchy generally works for simple web pages. However, when it comes to more complex web content — such as animations or WebGL — the snapshot returns a blank or static image. I believe this is because rendering such content requires access to the GPU, which is not fully available when the web view is off-screen.
That said, I’ve observed that certain apps are able to capture live animated web content inside their broadcast upload extensions, even when the main app is terminated. This suggests that the snapshot is not being generated by the main app or from a remote server — especially since the network activity confirms the content is served locally (via localhost or local IP).
Given this, I believe there must be a way to achieve GPU-accelerated rendering for WKWebView directly within the upload extension context, without attaching it to the app's UI. I would greatly appreciate any guidance, APIs, or recommended techniques that could help me achieve this behavior correctly and within system limitations.
Thank you in advance for your support. I look forward to your advice.
Warm regards,
                    
                  
                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
                    
                      I'm encountering an issue with front camera video recordings via browser (Safari/Chrome) on devices running iOS/iPadOS 18 and above:
On iPad, the recorded video appears upside down.
On iPhone, the recorded video is rotated 90 degrees.
The rear camera functions correctly without orientation issues.
This problem seems specific to browser-based recordings, as the native Camera app records videos with the correct orientation.
Has anyone else experienced this behavior? Is there a known workaround or fix?
The preview while recording is fine, the recorded video is oriented incorrectly.
                    
                  
                
                    
                      Dear all,
Is it possible to replace the default PDF background colour the 50% grey to any other colour while using the new WebView? Using the standard .background method on WebView does not appear to have any effect:
WebView(pdfWebpage)
    .background(Color.blue) // no effect on the background of the PDF
Thanks!
                    
                  
                
                    
                      Is the new Observations API for WebPage not available in Beta 1 as demoed in the WWDC video? I get this error even though Observation is imported.
                    
                  
                
                    
                      Hi everyone,
We work on a macOS plugin which then gets loaded into another application. I'm trying to load a webpage in that application through our plugin using a WKWebView & I set my class as the navigationDelegate for the same. I do not receive any callbacks for the WKNavigationDelegate methods. I have debugged & made sure that the navigationDelegate is actually set to my class. Here is a sample code of what I'm doing :
[[NSApplication sharedApplication] runModalForWindow:self.mWindowController.window];
- (void)windowDidLoad
{
    [super windowDidLoad];
    
    [self.window makeKeyAndOrderFront:self];
    [self.window orderFrontRegardless];
    
    if (self.mLoadingView == nil)
    {
        self.mLoadingView = [[LoadingView alloc] initWithFrame:[[self.window contentView] frame]];
    }
    [[self.window contentView] addSubview:self.mLoadingView];
    [self.mLoadingView showLoadingView];
    
    [self.window setLevel:NSMainMenuWindowLevel];
    
    [self loadWebPage];
}
-(void)loadWebPage
{
    [self.mWKWebView setUIDelegate:self];
    [self.mWKWebView setNavigationDelegate:self];
    [self.mWKWebView stopLoading];
    NSURL *lURL = [self samplePageURL];
    WKNavigation *lNavigation = [self.mWKWebView loadRequest:[NSURLRequest requestWithURL:lURL]];
}
- (void)webView:(WKWebView *)pWKWebView
didFinishNavigation:(WKNavigation *)pNavigation
{
    [self removeLoadingview];
    [self.mWKWebView evaluateJavaScript:@"document.body.setAttribute('oncontextmenu', 'event.preventDefault();');" completionHandler:nil];
}
I do not get any calls in the webView:didFinishNavigation: & I also tried other methods like webView:didStartProvisionalNavigation, webView:didFailProvisionalNavigation:withError: etc but did not receive any call in those either. Instead of runModalForWindow: if I use showWindow: on the mWindowController the webpage somehow loads but I still don't get any callbacks & so the loadingview subview is also present. The WKWebView is placed in a storyboard, and I have an IBOutlet connected to it in my class.
Has anyone faced a similar issue or can point me to something I might be missing? All help is appreciated. Thanks in advance.
                    
                  
                
                    
                      Canvas Previews (targeting macOS) in both Xcode 16.4 & Xcode 26 fail to load, when the project imports a Swift package that imports and uses WebKit.
I'm on macOS 15.5.
Tried also to bring minimum targets of both the project and the package to 15.0.
I see that there are some work-arounds for iOS simulator but nothing for the Mac.
Anyone facing the same problem?
                    
                  
                
                    
                      I am curious if the new WebView and WebPage APIs have a way to programmatically set if the web page should be shown in Reader Mode like you could with SFSafariViewController. I did not see a way to do this, but I'm curious if I may be missing something.
                    
                  
                
                    
                      Hello there,
back in the old WebKit API there was the WKDownloadDelegate to handle download actions in WebViews. I was wondering how to handle download actions within the new WebKit in SwiftUI. Is there anything to use already or are there workarounds to handle downloads?
Greetings,
Thorben
                    
                  
                
                    
                      I'm using the new Swifty WebView in 26.0 beta (17A5241e).
Previously, I would wrap WKWebView in a ViewRepresentable and place it in the detail area of a NavigationSplitView. The page content correctly shrunk when the sidebar was opened.
Now, the page content takes up the full width of the NavigationSplitView and the sidebar hovers over the page content with a translucent effect. This is in spite of setting .navigationSplitViewStyle(.balanced). Code below.
I believe this is a problem with the new WebView not respecting size hints from parent views in the hierarchy. This is because if I replace the WebView with a centered Text view, it shifts over correctly when the sidebar is opened.
struct OccludingNavSplitView: View {
    var body: some View {
        NavigationSplitView {
            Text("Sidebar")
        } detail: {
            WebView(url: URL(string: "https://www.google.com")!)
        }
        .navigationSplitViewStyle(.balanced)
    }
}
#Preview("Occluding sidebar") {
    OccludingNavSplitView()
}
                    
                  
                
                    
                      The new WebView implementation in *OS 26 versions is a very valuable addition to the SwiftUI toolset. I was experimenting with it and was wondering how to implement a Pull To Refresh. While this was easily achievable with the "old" WKWebView I was not able to find an API to implement, for example, a page reload when the user uses a pull to refresh gesture.
I tried to attach to a .refreshable(_:) modifier to the WebView but without success.
Is there an official API for that or should maybe .refreshable(_:) already work and it's just a bug or is it simply not yet supported?
Here is a minimal example I was trying but didn't succeed:
struct ContentView: View {
    @State private var page = WebPage()
    var body: some View {
        NavigationStack {
            WebView(page)
                .refreshable {
                    page.reload()
                }
        }
    }
}
Any help is much appreciated. Thank you!
                    
                  
                
                    
                      I’m a developer working on a Safari Web Extension that’s distributed via the  App Store and also tested locally through Xcode. I’m running into an issue that’s affecting my ability to debug errors reported to my Sentry error logging instance from production.
The Problem
When an error is thrown in one of my extension scripts (e.g., background.js, popup.js, or content.js), the error is sent to Sentry but the captured JavaScript error stack trace replaces the file paths with the webkit-masked-url://hidden placeholder like this:
ReferenceError: Cannot access uninitialized variable.
  at ? (webkit-masked-url://hidden/:14677:28)
  at ? (webkit-masked-url://hidden/:16307:3)
This happens consistently across both App Store builds and local Xcode runs. It prevents me from seeing which script the error came from or resolving the actual source code lines using uploaded source maps in Sentry.
My Setup
Safari Version: 18.5 (Stable on macOS)
Distribution: App Store and local Xcode development
Extension Type: Safari Web Extension
Error Reporting: Sentry (@sentry/browser SDK)
Bundler: Webpack with inline-source-map
What I’ve Confirmed
I can see the actual source files in Safari’s Web Inspector under the Sources tab when the extension is running.
My source maps are uploaded to Sentry correctly and are associated with the matching release.
Errors from Safari are being captured by Sentry, but the file URLs are masked, so stack traces cannot be resolved against my original source.
My Question
Is this behavior (masking file URLs in stack traces with webkit-masked-url://hidden/) intentional for Safari Web Extensions?
If so, is there any supported method or workaround to allow exception stack traces to reveal the original script path (e.g., popup.js, background.js) so tools like Sentry or even console logs can point to real locations? I fully understand the privacy/security rationale behind the masking, but as the extension developer, this is making it extremely difficult to debug runtime issues in production.
I’d really appreciate any insight into:
Whether this masking is expected and permanent behavior
If there are any entitlements, debug settings, or Info.plist keys that can alter this behavior for development or for trusted/own extensions
If Apple recommends a different way to log extension errors that includes script name or source references
Thanks in advance for your help! I’m happy to share more technical details or try out suggestions.
                    
                  
                
                    
                      Hi all,
I have a React web app that we use as a Progressive Web App (PWA). We currently:
Use PWA Builder to package it for Android and iOS
Host the app on a secure HTTPS URL
Use Firebase Cloud Messaging (FCM) for push notifications (working on Android)
However, on iOS, we are unable to get push notifications to work. I understand that PWAs on iOS have limited push support (Safari only, and not through WebView). So I explored using Capacitor, but:
Capacitor can load a server.url pointing to our hosted app (great for reuse), but push notifications don’t work
If we build the web app locally (npm run build) and embed it in the native iOS shell via Capacitor, push works
We would prefer not to fully merge our authentication and main app UIs if avoidable
Questions:
Is there any approved way to enable push notifications in an iOS .ipa built from a hosted web app (URL) using PWA Builder?
If not, is embedding the web assets locally the only Apple-approved way to get push support?
Are there any best practices or native plugin recommendations (e.g., APNs or FCM) for handling push notifications in iOS app?
Thanks in advance for any guidance. 🙏
Let me know if more technical details would help.
                    
                  
                
                    
                      I use WKWebView to display a webpage that requires authentication through an authentication provider. This works as expected, but when I close and reopen the app, I have to reauthenticate. However, if I open the same page in Safari, I only have to authenticate once. If I close Safari and reopen it, the page displays without prompting me to authenticate again. I see some cookies stored in httpCookieStore, so I assume that storing cookies works. Does anyone have an idea why authentication is not persistent between app launches? Thanks in advance.
Best regards,
Marc
                    
                  
                
                    
                      0x158c2ce18 - [pageProxyID=33, webPageID=34, PID=883] WebPageProxy::didFailProvisionalLoadForFrame: frameID=4294967298, isMainFrame=1, domain=NSURLErrorDomain, code=-999, isMainFrame=1, willInternallyHandleFailure=0
Error Domain=NSURLErrorDomain Code=-999 "已取消" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <9A09D8F8-351D-4BE3-A1F7-0E2E325DC7BA>.<4>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <9A09D8F8-351D-4BE3-A1F7-0E2E325DC7BA>.<4>"
), NSLocalizedDescription=已取消, _WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x159acf6c0>, networkTaskDescription=LocalDataTask <9A09D8F8-351D-4BE3-A1F7-0E2E325DC7BA>.<4>, NSErrorFailingURLStringKey=https://oamobile.zmmc.com.cn:28385/pages/Reports/ZBReport.aspx?ShowInLegend=true&appid=69b487001fcc11bc30c7344e50768c3c&userid=9784299b-cced-4702-91b0-0476511ba8d2, NSErrorFailingURLKey=https://oamobile.zmmc.com.cn:28385/pages/Reports/ZBReport.aspx?ShowInLegend=true&appid=69b487001fcc11bc30c7344e50768c3c&userid=9784299b-cced-4702-91b0-0476511ba8d2, networkTaskMetricsPrivacyStance=Unknown}
Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x159bd1830 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}
After upgrade to ios 26,
if WKWebView load url  which did not contain "#" will always ok.
but load url contain “#” will cancel when start load, then result in white screen
                    
                  
                
                    
                      When CHIPS was introduced in 18.4 it worked well, however on 18.5 it does not appear to work. There do not appear to be release notes about this in 18.5, so can someone provide definitive if this is a defect that will be fixed, or have they already been deprecated?
                    
                  
                
                    
                      Trying to implement my own forward/back buttons for the new SwiftUI WebView and reading the documentation I’m totally lost.
What’s the recommended way of implementing forward/back behavior with this component?
                    
                  
                
                    
                      Hi!
I configure proxy for webview like
DispatchQueue.main.async {
    self.webView.configuration.websiteDataStore.proxyConfigurations = [proxyConfiguration] 
}
It is fine in iosiOS 17 however, it crashes in iOS 18.3. And the problem seems to be related to the left side of the equation. I tried to call
print(self.webView.configuration.websiteDataStore.proxyConfigurations.count) 
in async block and got the same bad access error. But if stop at that line of code and call
po self.webView.configuration.websiteDataStore.proxyConfigurations 
in debugger it returns 0 elements.
Did anyone have the same problem? What may cause the exception?
                    
                  
                
                    
                      My app encountered a crash problem. The analysis stack seems to be related to the keyboard. The system keyboard code is unresponsive for a long time until it crash. The feature of the stack, BrowserEngineKit, seems to indicate the webview scene. Xcode debugging found that tap the input box on the webview page can reproduce the same stack as the crash, but the crash cannot be reproduced. I noticed a feedback link https://developer.apple.com/forums/thread/784718, which is the same as the top of the crash stack I encountered, so the root cause of the problem may be similar, caused by the locking operation related to UIKeyboardTaskQueue. Hope to give some suggestions. Thanks.
crash log:
Incident Identifier: 39E3AFE6-43B1-4DE6-AC2B-D62C5EC89752
CrashReporter Key:   AppleMetricKit
Hardware Model:      iPhone17,2
Process:             iAliexpress
Code Type:           ARM-64
Parent Process:      ? [1]
Date/Time:           2025-07-02 22:59:00
Launch Time:         Unknown
OS Version:          iPhone OS 18.1.1 (22B91)
Report Version:      104
Exception Type:  EXC_CRASH
Exception Codes: KERN_SUCCESS
Triggered by Thread:  0
Application Specific Information:
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: app<com.alibaba.iAliexpress(A182346C-2A09-4082-9AAE-0EC7A1A1B5AB)>:2263 exhausted real (wall clock) time allowance of 10.00 seconds
ProcessVisibility: Unknown
ProcessState: Running
WatchdogEvent: scene-update
WatchdogVisibility: Background
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 15.280 (user 9.430, system 5.850), 25% CPU",
"Elapsed application CPU time (seconds): 0.210, 0% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001ea7f7f90 __psynch_cvwait :8 (in libsystem_kernel.dylib)
1   libsystem_pthread.dylib         0x000000022296aa7c _pthread_cond_wait :1248 (in libsystem_pthread.dylib)
2   Foundation                      0x000000019908fa9c -[NSCondition waitUntilDate:] :132 (in Foundation)
3   Foundation                      0x000000019908bea8 -[NSConditionLock lockWhenCondition:beforeDate:] :80 (in Foundation)
4   UIKitCore                       0x000000019d05cbb4 -[UIKeyboardTaskQueue lockWhenReadyForMainThread] :784 (in UIKitCore)
5   UIKitCore                       0x000000019d05c85c -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] :160 (in UIKitCore)
6   UIKitCore                       0x000000019d56720c -[_UIKeyboardStateManager prepareForSelectionChange] :128 (in UIKitCore)
7   UIKitCore                       0x000000019d5674f4 -[_UIKeyboardStateManager selectionWillChange:] :72 (in UIKitCore)
8   BrowserEngineKit                0x0000000257671688 -[BETextInteraction selectionWillChange:] :84 (in BrowserEngineKit)
9   UIKitCore                       0x000000019d75d654 -[UIAsyncTextInteraction selectionWillChange:] :68 (in UIKitCore)
10  UIKitCore                       0x000000019dbae374 -[_UIKeyboardTextSelectionController beginSelectionChange] :64 (in UIKitCore)
11  UIKitCore                       0x000000019df5fed0 -[UITextSelectionInteraction tappedToPositionCursorWithGesture:atPoint:granularity:completionHandler:] :476 (in UIKitCore)
12  UIKitCore                       0x000000019df5f948 -[UITextSelectionInteraction _checkForRepeatedTap:gestureLocationOut:] :1072 (in UIKitCore)
13  UIKitCore                       0x000000019df60488 -[UITextSelectionInteraction _handleMultiTapGesture:] :852 (in UIKitCore)
14  UIKitCore                       0x000000019cf879cc -[UIApplication sendAction:to:from:forEvent:] :100 (in UIKitCore)
15  UIKitCore                       0x000000019d84ce98 -[UITextMultiTapRecognizer onStateUpdate:] :280 (in UIKitCore)
16  UIKitCore                       0x000000019cfb6ac4 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] :128 (in UIKitCore)
17  UIKitCore                       0x000000019cfb6934 _UIGestureRecognizerSendTargetActions :92 (in UIKitCore)
18  UIKitCore                       0x000000019cfb66f4 _UIGestureRecognizerSendActions :284 (in UIKitCore)
19  UIKitCore                       0x000000019cc69b28 -[UIGestureRecognizer _updateGestureForActiveEvents] :572 (in UIKitCore)
20  UIKitCore                       0x000000019cc3b724 _UIGestureEnvironmentUpdate :2488 (in UIKitCore)
21  UIKitCore                       0x000000019cd2fa00 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] :336 (in UIKitCore)
22  UIKitCore                       0x000000019cecffe4 -[UIGestureEnvironment _updateForEvent:window:] :188 (in UIKitCore)
23  UIKitCore                       0x000000019cecf3c8 -[UIWindow sendEvent:] :2948 (in UIKitCore)
24  iAliexpress                     0x0000000104e92000 -[UIWindow(AliHA) aliHASwizzledSendEvent:] UIWindow+AliHA.m:18 (in iAliexpress)
25  UIKitCore                       0x000000019cd63b70 -[UIApplication sendEvent:] :376 (in UIKitCore)
26  iAliexpress                     0x0000000104e91c84 -[UIApplication(SPM) alg_sendEvent:] AFSPMManager.m:0 (in iAliexpress)
27  UIKitCore                       0x000000019cd6409c __dispatchPreprocessedEventFromEventQueue :1048 (in UIKitCore)
28  UIKitCore                       0x000000019cd6df3c __processEventQueue :5696 (in UIKitCore)
29  UIKitCore                       0x000000019cc66c60 updateCycleEntry :160 (in UIKitCore)
30  UIKitCore                       0x000000019cc649d8 _UIUpdateSequenceRun :84 (in UIKitCore)
31  UIKitCore                       0x000000019cc64628 schedulerStepScheduledMainSection :172 (in UIKitCore)
32  UIKitCore                       0x000000019cc6559c runloopSourceCallback :92 (in UIKitCore)
33  CoreFoundation                  0x000000019a434328 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ :28 (in CoreFoundation)
34  CoreFoundation                  0x000000019a4342bc __CFRunLoopDoSource0 :176 (in CoreFoundation)
35  CoreFoundation                  0x000000019a431dc0 __CFRunLoopDoSources0 :244 (in CoreFoundation)
36  CoreFoundation                  0x000000019a430fbc __CFRunLoopRun :840 (in CoreFoundation)
37  CoreFoundation                  0x000000019a430830 CFRunLoopRunSpecific :588 (in CoreFoundation)
38  GraphicsServices                0x00000001e64101c4 GSEventRunModal :164 (in GraphicsServices)
39  UIKitCore                       0x000000019cf96eb0 -[UIApplication _run] :816 (in UIKitCore)
40  UIKitCore                       0x000000019d0455b4 UIApplicationMain :340 (in UIKitCore)
41  iAliexpress                     0x0000000104e9b0b8 _main main.m:17 (in iAliexpress)
42  dyld                            0x00000001bfe1eec8 start :2724 (in dyld)
                    
                  
                
                    
                      Hello there,
For a video like this <video src="blob:safari-web-extension://***" autoplay="" loop="" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; object-fit: cover; z-index: -1;"></video>, no matter if its local or remote, blob or mp4 files, is constantly being reloaded (refetched? revalidated?) if the loop tag is added. I can confirm there is actual constant traffic from the server based on my server logs. I am running iOS/macOS 26.
                    
                  
                
                    
                      Issue Description
I'm developing a hybrid iOS app and encountering WebView bridge communication issues after updating to Xcode 16 with iOS 18 SDK.
App Architecture
AViewController: Initial view controller displayed at app launch
Handles WebView setup and web-to-native bridge communication
Pushes BViewController when receiving "B" bridge message from web
BViewController: View controller stacked on top of AViewController
Managed by navigation controller
AViewController's WebView continues bridge communication even when BViewController is active
Problem Behavior
Xcode 15 (iOS 18): WebView bridge communication in AViewController works normally while BViewController is active
Xcode 16 (iOS 18 SDK): Server communication breaks or hangs without response while BViewController is active
Communication resumes only after popping back to AViewController from BViewController
Questions
Is the current architecture (configuring WebView in AViewController and maintaining bridge communication through AViewController's WebView while BViewController is presented) not a recommended pattern?
Is Xcode 16's iOS 18 SDK the cause of this issue? If so, could you help me understand which specific changes are affecting this behavior?
This is urgent as we need to deploy soon. I would greatly appreciate a prompt response.