The examination is being rejected due to a conflict issue in the webview.
It's a log file, what's the reason?
When tested with the device, it works fine.
WebKit
RSS for tagDisplay web content in windows and implement browser features using WebKit.
Posts under WebKit tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have implemented a custom view that shows a page in WKWebKit:
import SwiftUI
import WebKit
struct WebView: UIViewRepresentable {
let urlString: String
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
webView.navigationDelegate = context.coordinator
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
if let url = URL(string: urlString) {
let request = URLRequest(url: url)
uiView.load(request)
}
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: NSObject, WKNavigationDelegate {
var parent: WebView
init(_ parent: WebView) {
self.parent = parent
}
}
}
It works, but it shows a grey button in the upper left with no icon. If I click on that button, nothing happens. But I can see this error message in the Xcode logs:
Trying to convert coordinates between views that are in different UIWindows, which isn't supported. Use convertPoint:fromCoordinateSpace: instead.
What is this button, and how can I get rid of it?
As a second question: I also tried to spawn Safari in a separate window, using this view:
import SafariServices
import SwiftUI
struct SafariView: UIViewControllerRepresentable {
let url: URL
func makeUIViewController(context: Context) -> SFSafariViewController {
return SFSafariViewController(url: url)
}
func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {
// No update logic needed for a simple web view
}
}
This works, but Safari shows up behind the view that is including the Safari view. Instead, I would want Safari to show up in front - or even better: next to my main view (either left or right). Is there a way to do this?
Hi!
I watched the 'Analyze hangs with Instruments' video from WWDC2023. It's such a great video!
Unfortunately, I found a case that the video doesn't cover when profiling my browser app using Instruments:
As shown in the image, the hangs still occur even though my main thread is not busy, and I've also used the 'Thread State Trace instrument' to confirm that the main thread is not blocked either.
I'm not sure what the next step is to resolve the hangs. Any insight or guidance would be much appreciated. Thank you!"
Hello, I am experiencing an issue when running a script on Safari, specifically WebKit. Here is a sample HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<script>
function delayedFocus(e) {
e.preventDefault();
setTimeout(function() {
e.target.focus();
}, 1000); // Adjust the delay time as needed (in milliseconds)
}
</script>
</head>
<body>
<ul>
<li>
<input type="text" id="testtext" onmousedown="delayedFocus(event)">
</li>
</ul>
</body>
</html>
The logic behind this script is to introduce a 1-second delay when the user clicks on the textbox. After 1 second, the keyboard should appear.
Testing on Android mobile devices shows the expected behavior. However, on iPhones, the textbox receives focus, but the keyboard does not appear. This issue has been observed on various iOS versions, with the script working only on iOS 15.
If you have any insights or solutions to address this compatibility issue, it would be greatly appreciated. Thank you.
Does anyone know if it is possible to run chrome or chromium headless browser on iOS or React Native?
Ideally would want to get Puppeteer running
My Flutter app has a embedded webview I use to render LaTeX using mathjax.
With the recent iOS 17 updates (I believe it started happening with iOS 17.2/17.3) the embedded webview started crashing. This is the only output I'm seeing in the logs:
WebProcessProxy::didClose: (web process 0 crash)
WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid
ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error:
WebPageProxy::processDidTerminate: (pid ), reason=Crash
WebPageProxy::dispatchProcessDidTerminate: reason=Crash
GPUProcessProxy::didClose:
GPUProcessProxy::gpuProcessExited: reason=Crash
WebProcessProxy::gpuProcessExited: reason=Crash
WebProcessProxy::gpuProcessExited: reason=Crash
WebProcessProxy::gpuProcessExited: reason=Crash
WebProcessProxy::gpuProcessExited: reason=Crash
WebProcessProxy::gpuProcessExited: reason=Crash
ProcessAssertion::remainingRunTimeInSeconds failed to get handle for process with PID=
Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
ProcessAssertion::acquireSync Failed to acquire RBS assertion 'GPUProcess Background Assertion' for process with PID=695, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
Hi, we have a services worker configured in a web page to work offline. The page is loaded in the WKWebView component and we observe that the services worker is not registering correctly, is this component compatible with the API of the services worker? If so, how would be the correct implementation, if it is not compatible, what alternatives are there? thanks!
I'm currently developing hybrid MacOS app that display some content in WebKit. I wanted to write some UI tests using Appium for it. For this I'm currently using Mac2 driver https://github.com/appium/appium-mac2-driver
The problem that I faced is specifying identifiers for HTML elements to easily find them later in tests.
It seems Appium uses Accessibility framework to get list of elements. Also it seems that accessibility framework parses HTML and wrap them to XCUIElements in XML Source (I can see this in Appium inspector, check the screenshot)
As you can see Appium tries to get accessibility identifier/label from these elements.
While searching in web I found, that if we specify aria-label="something" property on HTML element, it will be parsed by accessibility framework as label. So we can use labels for locating elements. However in ideal scenario we should have some HTML property that will be parsed to identifier, as accessibility label is used for accessibility needs, while identifier is allocated for UI testing.
So my question is there HTML tag that can be used to specify identifier, and if not, is there plans to add support for it?
Is it possible to implement a login via Biometric TouchID FaceID in a Wkwebview? I'm not a developer and thank you in advance for your help.
Hello,
We're throwing up a brief webkit view for a login process and we are seeing it crash the webkit view intermittently but are unable to work out why this might be.
We have ruled out some environmental and network issues - and wondering if anyone can throw any hints our way based on the crash logs below?
Forum says its too long, so I've pastebinned it: https://pastebin.com/rw3HXLKp
Any help appreciated.
Hey there!
We recently release our app, and spotted a couple of crash reports in the last 2 released versions. It happened to 2 different users with the same iOS major version:
iPhone15.3, OS 17.1.2
iPhone15.3, OS 17.2.1
Attaching 2 different crash reports on (what seems to be) the same issue.
(the app name is changed for the security reasons):
After reading multiple StackOverflow, Github and Apple support threads on similar issue I wanted to add a couple of notes for the context:
our app is written in TypeScript
it's packed via Capacitor into iOS and Android bundles and is served via built-in browser
re/ CameraUI from the crash report - we have a functionality of picking the image from gallery, or using the camera to take a photo, if it's related
re/ permissions for that - we have:
<key>Privacy - Photo Library Usage Description</key>
<key>Privacy - Camera Usage Description</key>
in the Info.plist file set to:
<string>$(PRODUCT_NAME) photo use</string> and
<string>$(PRODUCT_NAME) camera use</string> respectively
Would appreciate any clues and ideas! Thanks in advance!
This is my h5 code:
id="myVideo" src="xxxapp://***.***.xx/***/***.mp4" style="object-fit:cover;opacity:1;width:100%;height:100%;display:block;possition:absolute;" type="video/mp4"></video>
I want to load local large video, so, I use WKURLSchemeHandler.
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask {
NSURLRequest *request = [urlSchemeTask request];
NSURL *url = request.URL;
NSString *urlString = url.absoluteString;
NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"***" ofType:@"mp4"];
NSData *videoData = [NSData dataWithContentsOfFile:videoPath options:nil error:nil];
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:url MIMEType:@"video/mp4" expectedContentLength:videoData.length textEncodingName:nil];
[urlSchemeTask didReceiveResponse:response];
[urlSchemeTask didReceiveData:videoData];
[urlSchemeTask didFinish];
}
but its not work, data is not nil, but video do not play. I would greatly appreciate it if someone could help me find a solution!!
ps: can make it, but we cannot use it due to some reasons.
There's WKWebView.find() method that highlights search result within a WKWebView element on macOS but I don't see any way to clear this highlight. When I search for an empty string is does nothing and the latest search result remains highlighted.
I made WebView with React.
cursor in the webview's textfield is in the wrong position.
What should I do?
Hi, i wanna access haptic on macbook via web application running in safari. It there any API for this? I.e. like vibrate API for other browsers?
what happened? i never noticed it until i decided to use ipad air and pro as option in chrome dev console mobile view as well as ios simulator.
it works ok in the ipad mini.
touch events do not get triggered. instead, the scroll seems to overlap these.
EDIT: Solved. please see comment below.
While it works ok in ipad pro devices now, I still wish this could work out in chrome's dev console ipad pro view. the behavior is different with click events.
instead of mouse down, it starts with mouse move. what gives? this only happens in ipad air and pro view in the device toolbar in dev console.
0x60700003ab00 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit uploads' for process with PID=56268, error: Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.assertions.webkit}
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.assertions.webkit}>
The above error occurs. What should I do?
Hi,
The below code is used for loading GPay icon dynamically from Google in "WKWebView". The same code works for later versions of IOS like 16.4, but issue happens in 16.1 ,16.2 and 16.3 versions.
while loading this code from IOS 16.3 the icon (Gpay icon) is completely black, looks like it's not loaded properly. Please assist us on what can be the issue, and how we can proceed to solve the issue.
Not working
Working
Hi,
we have a WebRTC application web application in which our video freezes in Safari 17 (no other browsers or earlier Safari).
Our application also uses js Websockets as part of signalling protocols. We seem to get video freezing when we establish and send data over
one of these websockets. We have seen various posts online about websocket fragmentation bugs causing ESP (?) issues with the new NSURLSession Websocket
implementation, but don't see any resolution (nor how in Safari 17 if we can switch back to a legacy websocket implementation).
Additionally, we don't appear to have problems with one of our APIs, which differs in the 'problematic' one in that it uses a Websocket with a
'binaryType' defaulted to 'Blob', whereas our troublesome one sets the binary type to 'arraybuffer'. I saw that the Safari 17 release notes mentions 'Fixed WebSocket’s binaryType setter to not throw. (109192086)' but, again, I can't find any further detail and whether this means that there are still issues with Safari 17 Websocket binaryType?
Obviously, we will try changing our implementation to use 'Blob' and see if this makes a difference, but it would be useful to know if anyone has had any similar issues with Safari 17?????
Kind regards,
Mike
Hi, in our app we have a WKWebView with complex web content that is loaded with cachePolicy: .reloadIgnoringLocalCacheData. If the app is in the background for several hours and returns in the foreground we noticed that the system reloads the webpage, but it does so with a cachePoliy returnCacheDataElseLoad. This could break the app if older cache content is present.
To reproduce start an app in the simulator (tested with iOS 17.2), put it in the background and via activity monitor stop the processes
com.apple.Webkit.WebContent
com.apple.Webkit.networking
After foreground the reload will happen.
Two questions:
why is this reload happening after some hours in the background? We haven't seen any crash reports related to this. It mostly happens on one of our test devices (iphone13 with iOS17.2.1).
why is the webview reloading with a modified cachePolicy (returnCacheDataElseLoad)?
Our temporary fix is to detect this case in "webView:decidePolicyFor navigationAction decisionHandler", cancel the request and reload with modified cachePolicy.
Any ideas?
Thanks,
Heiko
Sample code:
class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let config = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: config)
webView.uiDelegate = self
webView.navigationDelegate = self
view.addSubview(webView)
let myRequest = URLRequest(url: URL(string: "https://www.apple.com")!, cachePolicy: .reloadIgnoringLocalCacheData)
print("request \(myRequest)")
webView.load(myRequest)
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
print("start loading \(String(describing: navigationAction.request.url)), cache:\(navigationAction.request.cachePolicy)")
decisionHandler(.allow)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
let fullscreen = CGRect.init(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height)
webView.frame = fullscreen
}
}