Display web content in windows and implement browser features using WebKit.

WebKit Documentation

Posts under WebKit tag

275 Posts
Sort by:
Post not yet marked as solved
4 Replies
2.1k Views
Hi, I'm using MediaRecorder for screen recording of canvas , along with audio. simplified code to implement screen recorder //intialise stream const canvas = document.querySelector('.main-canvas'); const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); for (let track of canvas.captureStream().getTracks()) { stream.addTrack(track); } recorder = new MediaRecorder(stream); chunks = []; recorder.ondataavailable = ({ data }) => { if (data) chunks.push(data); }; recorder.start(); recorder.onstop = () => { const videoBlob = new Blob(chunks, { type: 'video/mp4' }); chunks = [] //stop mic access after use try{ for (let track of stream.getTracks()) { track?.stop(); } }catch(e){} return videoBlob; } so when i call recorder.stop() , the recorder.onstop method is not getting called sometimes randomly. And also in case when recorder.onstop is not called , recorder.ondataavailable is not called even a single time,So it returns empty Blob output. This only occurs in iOS 15 device's , it occurs randomly 40% of the times. Is there any workaround for this, or what is cause of this issue? Thanks in advance
Posted
by
Post not yet marked as solved
5 Replies
6.0k Views
I continually receive this error when using AdMob Banners (swift 5, on iOS simulator and devices using Xcode 13.5) it seems something related to Webkit, this continuous exception slows my app and continually produce network calls [ProcessSuspension] 0x10c240f60 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=94309, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
Posted
by
Post not yet marked as solved
2 Replies
1.4k Views
Hello I have a webrtc-based web app that is loaded inside a WKWebView. The web app gets loaded just fine in our iOS App running WKWebView on an iPad with iOS 15.1. We are using the exact same app, built for Mac Catalyst. However, on the Mac version, the web app gets loaded but the RTCPeerConnection object is undefined.. Meaning that our web app assumes that WebRTC is not available in that browser. Isn't the native app supposed to work the exact same on iOS and MacOS? Is the Mac version of WKWebView more limited than its iOS counterpart ? Is there any resource that states exactly what is supported in WKWebview in each platform? Thanks
Posted
by
Post not yet marked as solved
3 Replies
1.8k Views
We have been searching for almost one year for answers as to why wkWebView using an Entitled Domain will allow Autofill with KeyChain to fill credentials, but will not trigger Autofill to store/save them. In other words, if users have previously stored credentials in Safari while visiting domain X, subsequent visited to wkWebView with entitled domain X will allow use of those credentials in wkWebView through the Autofill/Keychain dialogue. However, users cannot save/store credentials within wkWebView in Trusted domain X because the save dialogue is never triggered.
Posted
by
Post not yet marked as solved
4 Replies
3.1k Views
I wrote a code like the example below to execute javascript code that has no return value. let webView: WKWebView // after load complete let result = await webView.evaluateJavascript("someFunction()") // :0: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value but when i use method with completion handler manner, it doesn't be crashed. but Xcode enforces me to use 'await' keyword and warning is bordering me await webView.evaluateJavaScript("someFunction()", completionHandler: nil) // warning: Consider using asynchronous alternative function The differnce I found is the different signature. Completion handler version has Optional result type, but async/await version has just Any result type func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, Error?) -> Void)? = nil) func evaluateJavaScript(_ javaScriptString: String) async throws -> Any my Xcode version is 13.2.1. Hope to fix it soon.
Posted
by
Post not yet marked as solved
3 Replies
974 Views
I have a function where user can open webpage in inappbrowser and make payment there. I get this error as below when user want to make payment. My apps have no issue when launch webpage, but when user click to pay and payment gateway call selected bank url, inappbrowser suddenly closed. android is working fine but having problem only in ios. I already update webview to latest version and enable ATS.. but didnt working at all. this is a critical bugs since my users unable to make payments for now. Please help me. thank you Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=5315, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=5315, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
Posted
by
Post not yet marked as solved
2 Replies
4.1k Views
I have an iOS native app. I have added WKWebView to view controller to show html content. class MyHTML1ViewController: UIViewController { private var webView: WKWebView! var htmlFile: String = "" // default value, can be changed override func viewDidLoad() { super.viewDidLoad() let url = Bundle.main.url( forResource: htmlFile, withExtension: "html") let request = URLRequest(url: url) webViewBase.load(request) } ... } I run the app on my iPhone through Xcode. It displays html content fine. However, on closing the view, I saw the following error messages in console: ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Suspended Assertion' for process with PID=91330, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> Should I add webkit entitlement? how can I do it in Xcode? I prefer to get rid of this error message if they are just warning in console, does not causing app crash. My Xcode is Version 13.4.1.
Posted
by
Post not yet marked as solved
1 Replies
647 Views
When a WKWebView implements the WKNavigationDelegate protocol, clicking a link inside the webview gives back WKNavigationTypeLinkActivated as WKNavigationType in the decidePolicyForNavigationAction. But clicking on a link inside an iframe gives back WKNavigationTypeOther, which makes it impossible to know if the url is requested on load or on click. Context: When a webview loads html (and embedded css, js, iframes, or XHR calls from JS ...), decidePolicyForNavigationAction gives back WKNavigationTypeOther as actionType , so I know content is loading and should be rendered in the webview. When a link is clicked, it gives back WKNavigationTypeLinkActivated so I know I need to show an in-app browser to show the content. This isn't the case with links clicked within an iframe (an <a> tag with href attribute); they return WKNavigationTypeOther
Posted
by
Post marked as solved
3 Replies
5.2k Views
Good morning! I am developing an iOS app that gets its data from an API and displays it in a list. The list item view has NavigationLink embedded in it that sends users to a detail view. In this detail view, I have some Text views but the issue I am running into is a WKWebView that I have implemented to display some HTML that's is retrieved from the API call. The WKWebView displays the HTML just how I want it to. The issue I have is in the HyperLinks that are displayed in the WKWebView. When a user taps on a link, it opens inside of the web view. Instead of opening in the web view, I would like this link to open in the user's default web browser. I have searched and found ways of doing this in older versions of Swift using classes but my web view is initialized inside of a struct that conforms to the UIViewRepresentable protocol. I don't know how to get links to open in the browser instead of the WebView so any help would be appreciated. Here is the code for my WebView that is being used on the details page. struct NewsItemWebView: UIViewRepresentable { // HTML from API Call     var text: String // Method to create the View     func makeUIView(context: Context) -> WKWebView {         return WKWebView()     } // Method to update the View by changing properties of the WebView     func updateUIView(_ uiView: WKWebView, context: Context) {         uiView.isOpaque = false         uiView.backgroundColor = UIColor.white         uiView.loadHTMLString(text, baseURL: nil)     } } Here is how I am implementing the WebView on DetailView NewsItemWebView(text: item.PageContent) .frame(height: 450) Any help on how I can make links open in a browser would be great. Thanks in advance.
Posted
by
Post not yet marked as solved
1 Replies
880 Views
In webkit while loading webcontent in iframe. Not getting any url from any of the delegate method. Also getting error message of frame . Error showing - WebPageProxy::didFailProvisionalLoadForFrame: frameID=7, domain=NSURLErrorDomain, code=-999, isMainFrame=0
Posted
by
Post not yet marked as solved
1 Replies
1.3k Views
we have wkwebView page which use js bridge to launch camera to take photos. some times the "webViewWebContentProcessDidTerminate:" get called ,we have to relaod the page(it don't,the page will go blankl or unresponsive),but then the user content was lost. By my experience,this is associate with memory。at the moment we take photo,the total memory useage get high more the 10~20M high. but when I don't l;aucn the camera,it's worked well. i have question about this. how to reduce the memory useage by camera at the moment?I has already add @autoreleasepool to the take photo finish event,it's get down when finished, it has a peak but I want it keep steady。 as we know the wkwebview work in independent process,how the memory useage can affect the wk process? any other way to prevent this? please help!
Posted
by
Post not yet marked as solved
1 Replies
934 Views
My app is using a web view for rendering some web content. Intercepting navigation events via decidePolicyFor delegate method works great as long as Javascript is not enabled for the WkWebView. As soon as I enabled Javascript, only the first URL request is handled by the delegate. Any future URL requests do not get handled by the delegate.
Posted
by
Post not yet marked as solved
1 Replies
1.6k Views
Hello everyone! I am using the web version of the Apple Music Kit API, and similar to how Apple is able to produce a user's year in rewind playlist showing the most played artists/songs from a year, I am trying to replicate it for either a year or all time. I have been searching the internet for days trying to figure it out, but I've been completely stuck. I am able to make the following HTTP request successfully. GET https://api.music.apple.com/v1/me/library/songs/ which returns back the user's library of songs, but I haven't figured out how to get the play count. I have tried adding a query like such ?extend=playCount, but that doesn't work. I can see here that the Swift Music Kit API is able to extend a play count property, but I haven't been able to figure it out for Web. Ideally, I am looking for an endpoint that just shows a user's top artist/tracks similar to Spotify, however, whenever I try to use the heavy in rotation endpoint here, it always returns an empty array. The way that I have described is the long-roundabout way where I'll have to fetch each individual song and sort by playCount. But if anyone happens to know how I can do either of the options I've described, it will be truly appreciated ! I've seen other forums posts from years ago, but hopefully there's been a discovered way. Thank you!
Posted
by
Post not yet marked as solved
2 Replies
1.2k Views
We have QR-scanner feature implemented on web view (WKWebView). If it's dark we want to light our QR-code using flashlight in iPhone. In general, this feature works, but without flashlight. But have that problems: If we turn on torch then camera preview disappears. If turn off torch then camera preview appears. Do you have any idea why it's so? And how can we sort it out? Thanks
Posted
by
Post not yet marked as solved
3 Replies
6.2k Views
In our game app, we have screens before/after game levels which are transparent wk webviews. This works great. We have interesting, complex css-based animations. We recently added some Lottie animations, which use a javascript fetch() on a .json file, and that throws a CORS error since you can't normally fetch file:// urls from the app bundle.  The error is eliminated if we set allowFileAccessFromFileURLs to true, but it's an undocumented preference of webkit (not a secret iOS method). It's clearly included in the public WebKit github (in WKPreferences.mm). We have other ideas for workaround, such as JS injection.  Is allowFileAccessFromFileURLs OK to set to TRUE?  Is it a risk of app rejection, and/or a significant risk of being removed int he future, and/or and otherwise bad idea? Do you have any other tips about loading data into web views in-app?
Posted
by
Post not yet marked as solved
1 Replies
864 Views
Dear Apple Developers, I am an avid user of iCloud Notes Web on Windows 10, and I have noticed that a crucial functionality is currently missing – the ability to insert or paste images. As someone who frequently uses the Notes app in both Windows and the Apple ecosystem, I believe adding this feature to iCloud Notes Web would greatly improve the user experience. Given that many of us use iCloud Notes to keep track of important information, including images, this missing feature is a significant inconvenience. Without it, users may be forced to resort to alternative products like OneNote. I strongly recommend that you consider adding the ability to insert or paste images to iCloud Notes Web in order to better serve your users and provide a more complete and functional notes-taking experience. Thank you for your attention to this matter. Best regards, Byronmonkey
Posted
by
Post marked as solved
4 Replies
1k Views
I'm trying to enable the web inspector on WKWebView in a Mac Catalyst app. I'm only doing this for debugging purposes. In the released the web inspector will not be enabled. Doing this under Mac Catalyst does not work:  WKPreferences *prefs = [[WKPreferences alloc]init];   [prefs _setDeveloperExtrasEnabled:YES]; //Assign the WKPreferences to a WKWebViewConfiguration and create the web view.. Is there any way to do this? Thanks in advance.
Post not yet marked as solved
4 Replies
841 Views
Setting elementFullscreenEnabled property to YES on WKPreferences is not honored on Mac Catalyst.  WKWebViewConfiguration *webViewConfig = [[WKWebViewConfiguration alloc]init];  WKPreferences *prefs = [[WKPreferences alloc]init]; prefs.elementFullscreenEnabled = YES;   webViewConfig.preferences = prefs; //then create the WKWebView.. I load a Youtube url in the WKWebView. Youtube complains that the browser doesn't support full screen. Is there a workaround? Full screen does work in an AppKit app though using the exact same API...though it causes an Autolayout crash (I will be making another thread about that separate issue shortly).
Post not yet marked as solved
7 Replies
3.5k Views
I managed to get my Progressive Web App to send notifications to users via Web Push. However, it seems that the definable actions are not working. In Chrome, there is a button in the notification. If you click it, you get an overview of the available actions that the user can click. When I look at the notification on iOS, I only see the "View" action. My self-defined actions seem to be ignored and not displayed. Also, the "notificationclick" event should be executed by the browser as soon as the notification is clicked. In the Serviceworker I listened to the event and tried to link to a specific page of the PWA. In Chrome and Firefox this works fine. In Safari / iOS I only get to the start page of the PWA. Are the notification actions not yet supported with WebKit 16.4 ?
Posted
by