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

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

WebKit Instance Intermittent Crashing
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.
2
0
540
Jan ’24
iOS app crash - EXC_CRASH (SIGABRT)
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!
3
0
1k
Jan ’24
Why I cannot response video data on ios15 with WKURLSchemeHandler
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.
0
0
422
Jan ’24
touch events do not work in ipad air and pro
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.
1
0
570
Jan ’24
How can I add "WebKit uploads"?
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?
0
0
311
Jan ’24
"Google pay button icon" not visible in specific iOS versions
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
0
0
501
Jan ’24
Possible issues with Websockets in Safari 17?
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
1
0
603
Jan ’24
Strange reload behavior, WKWebView reloads with returnCacheDataElseLoad after background
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 } }
2
1
607
Jan ’24
iOS17 PWA `position: fixed` element breaks after a while
I have a menu bar which overlays a body scroll in my PWA with styling: position: fixed; bottom: 0px; This works fine after launching the PWA. In addition to scrolling my app also has a dialog overlay which is invoked many times during regular use. The bug: After a few hours of mixed use and backgrounding the app, the position fixed bottom does not stick to the bottom of the page when scrolled down. It is almost as if there is an invisible Safari navbar that pushes the viewport up (the PWA forgets it's not in Safari? :)). On scroll down With the dialog open This one is a bit tedious, but I am able to consistently reproduce it on my app following these steps and with also with a stripped down HTML: Create a PWA app on a iOS17 device with the following html: https://github.com/apsm100/ios17-pwa-position-fixed-bug/blob/main/index.html Open the app and open and close the dialog a few times. Leave the app open in the background for a few hours and periodically open it up to test scrolling up and down and opening and closing the dialog. Eventually you will see the bug. I am not entirely sure if the dialog has any role in this, I haven't gotten that far in testing. Since I use my app daily I would say it happens about after an hour of backgrounding and a few minutes of use. Thank you!
2
1
1.6k
Jan ’24
iOS15 h5 video element cannot play video
This is my h5 code: <video 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.
1
1
659
Feb ’24
How to reset the CookieAcceptPolicy setting for NSHTTPCookieStorage.
I made a change to the CookieAcceptPolicy in NSHTTPCookieStorage in my app: [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyNever]; When I use the following code to restore its settings: [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain]; WKWebView still does not store cookies. I found that in iOS 17, the cookie policy for WKWebView can be enabled through the following configuration: [[[WKWebsiteDataStore defaultDataStore] httpCookieStore] setCookiePolicy:WKCookiePolicyAllow completionHandler:^{}]; But how can this be done in versions prior to iOS 17?
0
0
218
Jan ’24
Need Help with Error message on Visual Studio Code
Beginning to Learn C++ in school, Just trying to figure out why my program version is saying this? I am a student in school and am learning Visual Studio Code because that's the only way to use C++ anyways I put in a basic code and I'm getting this error message. I have included my code and then the error response. Can anyone tell me what went wrong? I feel like it should be all legit... #include using namespace std; int main() { cout << "welcome to C++!"; return 0; } Error Response Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
2
0
282
Jan ’24
iOS speech recognition: webkitSpeechRecognition in a WKWebview vs. native SFSpeechRecognizer
I have a prototype web view (in a WKWebView) that uses webkitSpeechRecognition for getting short snippets of text from speech. I'm not thrilled with the quality of the "recognition" - the text generally isn't very accurate. I'm wondering if I'll get any more accuracy by using the "native" SFSpeechRecognizer. It seems to me that webkitSpeechRecognition is likely just a Javascript wrapper interface for SFSpeechRecognizer, and the quality of the speech recognition won't improve. Does anyone know for sure if this is the case? Does webKitSpeechRecognition on iOS use SFSpeechRecognizer under the hood? Or are they two completely different recognition systems, and one could be more accurate than the other?
0
0
628
Jan ’24
Intercept WebView requests and add Auth token in all subsequent resource request [GET .js, .png, .css].
Intercept WebView requests and add Auth token in all subsequent resource request [GET --> .js, .png, .css]. We have tried the below delegate methods and those call are not getting invoked. We have a challenge with Webview when load our application URL. func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) { func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { we are looking for some delegate or protocol to intercept the request to add the token for all the requests. is there any possible solution to fix this issue? Thanks
1
1
799
Feb ’24
Intercept WebView requests and add Auth token in all redirect/subsequent request.
We have a challenge with Webview when load our application URL. Initial call we are passing all the information with token and its works fine, but we are getting 401- unauthorized for some of the subsequent redirect request while loading webview. looks like server is expecting auth tokens for all the redirect/subsequent request. we are not able to intercept the request to add the token for all the requests. is there any possible solution to fix this issue? Thanks
1
0
583
Jan ’24
Wkwebview doesn't upload photo from camera
I have wkwebview, from it the camera is triggered, a photo is taken and uploaded to the web. 
The problem is that when the photo is taken nothing happens on the web, the camera just closes and that's it, the button in webview that opens the camera stops triggering until you re-enter the application. Permishen to use the camera is added. 

If you open through safari - everything works, android also has the expected behavior, but in webview ais does not want to load. Maybe something new has appeared in webview that needs to be enabled, given permission? Tryedto allow inlinedmediaplayback, allowArbitryLoads
1
0
574
Dec ’23
Crash iOS 17.1 - WebSelectionRect
The application that I'm working on uses WebKit. I'm seeing some crashes that happen only in iOS 17.1, regarding the WebSelectionRect. NSInvalidArgumentException: -[WebSelectionRect _transform]: unrecognized selector sent to instance 0x280e18dc0 0 CoreFoundation +0xec86c ___exceptionPreprocess 1 libobjc.A.dylib +0x2bbfc _objc_exception_throw 2 CoreFoundation +0x17d198 -[NSObject(NSObject) doesNotRecognizeSelector:] 3 CoreFoundation +0x31ff4 ____forwarding___ 4 CoreFoundation +0x172b0c ___forwarding_prep_0___ 5 UIKitCore +0x9314ac -[_UITextChoiceAccelerationBubble updateWithChoices:fromParentView:referenceTextView:presentedFromRect:] 6 UIKitCore +0x93a8cc ___96-[_UITextChoiceAccelerationAssistant showPromptForReplacementCandidate:originalCandidate:delay:]_block_invoke 7 Foundation +0x74dd68 ___NSFireTimer 8 CoreFoundation +0xad5cc ___CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ 9 CoreFoundation +0xad274 ___CFRunLoopDoTimer 10 CoreFoundation +0x36e70 ___CFRunLoopDoTimers 11 CoreFoundation +0x33e88 ___CFRunLoopRun 12 CoreFoundation +0x33664 _CFRunLoopRunSpecific 13 GraphicsServices +0x35e8 _GSEventRunModal 14 UIKitCore +0x22d37c -[UIApplication _run] 15 UIKitCore +0x22c9b8 _UIApplicationMain 16 *** +0xe330 main (main.m:16:10) 17 dyld +0x5dc8 start This behavior was not seen in any other iOS version. Is there a way to find the reason for this error? Or has anyone faced it and could solve it?
1
0
322
Jan ’24