Explore WKWebView additions

RSS for tag

Discuss the WWDC21 session Explore WKWebView additions.

Posts under wwdc21-10032 tag

73 Posts

Post

Replies

Boosts

Views

Activity

[pageProxyID=5, webPageID=6, PID=22420] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -999
func loadURL(_ request: URLRequest) {         navigationDelegate = self         uiDelegate = self         load(request)         scrollView.delegate = self     }          func loadURL(_ path: String) {         navigationDelegate = self         uiDelegate = self                  let url = URL(fileURLWithPath: path)         let data = try! Data(contentsOf: url)         let baseURL = url.deletingLastPathComponent()                  load(data, mimeType: "application/pdf", characterEncodingName: "", baseURL: baseURL)                  scrollView.delegate = self     } } extension ProdWebView: WKNavigationDelegate {          func webView(_ webView: WKWebView,                  didStartProvisionalNavigation navigation: WKNavigation!)     {         webViewDelegate?.start()     }          func webView(_ webView: WKWebView,                  didFailProvisionalNavigation navigation: WKNavigation!,                  withError error: Error)     {         trace?.stop()         webViewDelegate?.error(error)     }          func webView(_ webView: WKWebView,                  didFinish navigation: WKNavigation!)     {         trace?.stop()         webViewDelegate?.stop()     } When user click on The Links double times .... I am getting crash I can see in auto logs code = -999 error 2021-10-03 21:04:43.113096+0530 eTradeMX[22419:6003510] [Process] 0x1070a1818 - [pageProxyID=5, webPageID=6, PID=22420] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -999 But below delegate method is not calling . Some times its calling some Times not calling . I was written delegates also   weak open var navigationDelegate: WKNavigationDelegate?     weak open var uiDelegate: WKUIDelegate?     navigationDelegate = self     uiDelegate = self   func webView(_ webView: WKWebView,          didStartProvisionalNavigation navigation: WKNavigation!) expect this didStartProvisionalNavigation remaining delegates are calling properly .
2
0
5.2k
Nov ’21
Safari Web Inspector do not see my WKWebview on macCatalyst app (without Xcode)
I have a macCatalyst app. I can see the WKWebview pages in the Develop tab of Safari on my Mac when the app is started from Xcode. I can see the WKWebview pages in the Develop tab of Safari on my iPad when started on the device (not started by Xcode) If I start the same app on my Mac but normally this time (not from Xcode), all I get is "No Inspectable Applications". I have set com.apple.security.get-task-allow to 1 like other internet post has suggested, still not working. Please help me, my web colleagues need to be able to debug their webpages in the context of my app running on their mac. My Xcode and macOS is the latest version.
0
0
986
Nov ’21
EditText in WKWebView is not working on iOS15 but iOS14
Hi everyone, I use the TabView to implement five tabs. And each tab has one WKWebView. Every time I tap the editext from the URL page on WKWEbView, it always jump out and back to the first tab's page. The issue had happened to iOS 14.2. But it was fixed after I upgraded higher iOS version than 14.2 to fix it. Now the issue has happened again since I upgraded the iOS to 15 versions. Does anyone face the same problem like me? Or is there any configuration I need to enable to fix it?
0
0
335
Nov ’21
Cordova hybrid app latest IOS OS 14.6 and 14.7 wkwebview certain user local storage was cleared
Hi Team, this is one of my Cordova hybird iOS apps in production. Certain users' local storage was suddenly cleared off with the latest IOS versions, such as 14.7 and 14.6. Even though the devices had plenty of storage. Recently, we implemented wkwebview instead of UIWebview. We could not find the cause. Could you please help me locate the cause? Thank you. We are using below configuration: 9.0.0 cordova-lib-9.0.1 ios6.0.0 cordova-plugin-wkwebview-file-xhr 3.0.0 "Cordova WKWebView File XHR Plugin"
0
0
363
Nov ’21
How do i get the whole background to be the same color?
The background behind my HStacks is not the same. Can anyone help? I need to get rid of the black outlines in the HStack. Please and Thank you. import WebKit struct WebView: UIViewRepresentable{       let request : URLRequest       private var webView: WKWebView?       init (request: URLRequest){           self.webView = WKWebView()     self.request = request   }       func makeUIView(context: Context) -> WKWebView{     return webView!   }       func updateUIView(_ uiView: WKWebView, context: Context) {     uiView.load(request)   }   func goBack(){           webView?.goBack()   }           func goForward(){           webView?.goForward()   }       func goHome(){           webView?.load(request)   }       func refresh(){           webView?.reload()   } } struct ContentView: View {               let webView = WebView(request: URLRequest(url: URL(string:  "https://www.itechmania.it/")!))       var body: some View {                       ZStack {       Color.init(red: 0, green: 0.4157, blue: 0.5686 )         .ignoresSafeArea([.all])                       webView                   }                                            HStack{                                      Button(action: {                                               self.webView.goBack()                                             }) {                       Image(systemName: "arrow.backward.circle")                         .font(.title)             .foregroundColor(.white)             .padding()                                   }                   Spacer()                     Button(action: {           self.webView.goHome()                     }) {                       Image(systemName: "house.fill")                         .font(.title)             .foregroundColor(.white)             .padding()                     }                 Spacer()                                                             Button(action: {           self.webView.refresh()                     }) {                       Image(systemName: "arrow.clockwise.circle.fill")                         .font(.title)             .foregroundColor(.white)             .padding()                     }                             Spacer()                               Button(action: {           self.webView.goForward()                     }) {                       Image(systemName: "arrow.forward.circle")                         .font(.title)             .foregroundColor(.white)             .padding()                       }                                                                                      }              .background(Color.init(red: 0, green: 0.4157, blue: 0.5686))                                                 }               } struct ContentView_Previews: PreviewProvider {   static var previews: some View {           ContentView()   }         }
2
0
1.1k
Oct ’21
In iOS 13, json fetch in js is loading infinitely
After loading jsp url in WKWebView, doing evaluateJavaScript for doing some operations. In there, json files from VM is trying fetch. That is failing. const fetchData = async(path) => { try { let fetchResponse = {} if (path) { const response = await fetch(getURL(path)) const responseData = await response.json(); fetchResponse = responseData; } return fetchResponse } catch (e) { console.log(Error in fetchData ${path}, e) } }
0
0
683
Oct ’21
Restrict file upload from WKWebview
Is there any callback received at WKWebview when choose file button is tapped? I want to restrict the file upload from WKWebview, I don't want bellow popup to be loaded. I also want to understand which component is responsible for adding this popup ? Kindly help
0
0
957
Oct ’21
How to call synchronous JavaScript code in WKWebView
How do I, from my objective C cocoa app code, invoke javascript in my WKWebView's page and get a return value without having to over complicate my app and account for other events being processed in between the call to javascript and after it's done? Is this not implemented? I've looked all over the internet and this seems like a highly requested feature with no solution. I understand there may be different processes involved, but process synchronization is done all of the time and doesn't seem like a real technical barrier at least in theory (though I'm not sure what the underlying codebase looks like and what it'd take to get there). Alternative to get to the same problem's solution: before calling evaluateJavaScript, is there a way to disable other events from being concurrently processed until my completionHandler so that I can resume processing events and achieve the same effect? I don't have a depth of knowledge of NSRunLoops, so let me know if that question is exposing some misunderstanding.
0
0
417
Oct ’21
Screen recording restrictions for default player, playing a video in full screen using webview
How to restrict or close the video played in default player of webview for ios when user starts screen recording? What I have done is!!! In order to achieve data hiding when screen recording is ON, Notification center is used to notify the changes for screen recording. I have used if else condition to check if the screen recording is ON or OFF. Based on above checks i am hiding the window as window.ishidden = true/false With the above condition i am able to restrict user from recording the data present on screen. Failure case: The app is totally on webview. When user clicks on a course it shows the list of videos. When clicked on any of the video it plays with the iOS default player on a full screen. When the user starts on screen recording the window.isHidden = true and user will not be able to see anything on screen. Like wise when the user taps on a video in webview and it starts playing in a full screen and user taps on screen recording the window.isHidden = true but the video still Plays. By showing the window hidden property to true. When I close the player then as the window.ishiddenproperty is TRUE the screen becomes blank with no content visible. Please do help me with this as i am using webview which loads up the data and player might be on top of window element.
0
0
784
Oct ’21
iOS 15 WKWebView unexpected microphone behaviour while displaying website from local storage
Our app displays a website from local storage (meaning our WKSecurityOrigin protocol is file, not https) which connects to a local Asterisk server over wss://* in order to make and receive Sip calls from and to intercroms in the users local network. The sip connection works as expected and we're able to make and receive calls. After we've established voice communication to an intercrom, we're able to receive and play the audio information from the other party but we aren't able to send any audio information back from our iOS device. The WebView doesn't display any errors and we're able to access navigator.mediaDevices.getUserMedia without any problems. It's like the microphone on our iPhone was muted (which isn't the case though, our WKMediaCaptureState is Active). If we load the same website from https://, this problem disappears and the other party is able to hear us. We also handle the microphone permission request with this rudimentary code in our WebView: - (void) webView:(WKWebView *)webView      requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin      initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type      decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler      API_AVAILABLE(ios(15.0)) {   if (type == WKMediaCaptureTypeMicrophone) {     decisionHandler(WKPermissionDecisionGrant);   } } Previously we just relied on the user clicking "Allow" in the popup which asked if they'd accept the app accessing the systems microphone. Either way, microphone access, if granted, shouldn't be the issue here. We've also built a testing website to see what the data received from the microphone looks like in the WebView. By implementing this we can see, that the data chunks received from the MediaRecorder are empty while loading from file and contain data while loading from https. This tells us that once again, iOS treats file contexts differently from https even though they're both considered equally secure contexts. Our setup was working after this was fixed in iOS 14.5 now it's once again broken and we have no idea why. We don't know if the WebView behaves the same towards camera access. We'd be glad if somebody could tell us if this was expected behaviour and how iOS is going to treat the file context in the future. We rely heavily on displaying our website from local storage because the website allows the used to control their home and we don't want to download this potentially large website every time they open our app since reducing interaction time is key here. *to securely connect to the local server we installed the root CA with which the Asterisk's server cert was signed on our iOS system, this results in the WebView trusting our Asterisk server and allowing secure connections to it
0
0
1.7k
Oct ’21
WKWebView is not showing error message for unknown host
Hi, I am using WKWebView to showing some web content to user in my application. it is working fine for valid url. but when I try to load a request for invalid url it's show an empty view and getting an error in didFailProvisionalNavigation delegate method. but in other side SFSafariViewController shows an error message for invalid url. like "Safari cannot open the page because the server cannot found" is it any configuration/api for WKWebView so we can achieve the same behaviour like SFSafariViewController for invalid url? means, show the error message instead of blank screen.
0
0
791
Oct ’21
"Selected Date", Reset, Ok buttons, previous and next and icons on not visible.
Hello Apple Team, As described in the subject and from the attached screenshot we are not seeing the labels, icons, and selected date in the date picker for iOS version 14.0 and above. We are using WKWebview to load the forms, using HTML tag input type="date"> to show the date picker. Environment Details: xCode version 12.4 Swift version 5.0. The app is developed in native iOS. We tried different ways to fix this issue but to no avail. Guide us to fix this, as it is a production issue. Let us know for any other clarifications, waiting for your response ASAP.
0
0
757
Sep ’21
iOS 15 WKWebview evaluateJavaScript API does not work for accessing "window.subObj"
We call webView evaluateJavaScript:javaScript completionHandler:^(id _Nullable result, NSError *_Nullable error) API to inject a javascript to WKWebView. The javascript contains "window.xxx"definition. Since iOS 15, "window.xxx" can not be found and it will return "undefined" when accessing "window.xxx" . It seems that javascript "window" object can not have any custom sub-object. However same javascript code works fine on iOS 14.x and below. Any ideas? Thanks!
4
0
3k
Sep ’21
WKWebview.evaluateJavaScript doesn't return when disconnect the internet.
Below is my code: let loginButton = "document.getElementById('loginButton').click()" webView.evaluateJavaScript(loginButton) { result, error in print(result, error) } It works fine when the device has internet. But before calling this func, I turn off the internet, the func is called but nothing returned. Can I set a timeout for this func or get a callback error from anything to know there is an error. Thanks.
0
0
401
Sep ’21
[pageProxyID=5, webPageID=6, PID=22420] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -999
func loadURL(_ request: URLRequest) {         navigationDelegate = self         uiDelegate = self         load(request)         scrollView.delegate = self     }          func loadURL(_ path: String) {         navigationDelegate = self         uiDelegate = self                  let url = URL(fileURLWithPath: path)         let data = try! Data(contentsOf: url)         let baseURL = url.deletingLastPathComponent()                  load(data, mimeType: "application/pdf", characterEncodingName: "", baseURL: baseURL)                  scrollView.delegate = self     } } extension ProdWebView: WKNavigationDelegate {          func webView(_ webView: WKWebView,                  didStartProvisionalNavigation navigation: WKNavigation!)     {         webViewDelegate?.start()     }          func webView(_ webView: WKWebView,                  didFailProvisionalNavigation navigation: WKNavigation!,                  withError error: Error)     {         trace?.stop()         webViewDelegate?.error(error)     }          func webView(_ webView: WKWebView,                  didFinish navigation: WKNavigation!)     {         trace?.stop()         webViewDelegate?.stop()     } When user click on The Links double times .... I am getting crash I can see in auto logs code = -999 error 2021-10-03 21:04:43.113096+0530 eTradeMX[22419:6003510] [Process] 0x1070a1818 - [pageProxyID=5, webPageID=6, PID=22420] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -999 But below delegate method is not calling . Some times its calling some Times not calling . I was written delegates also   weak open var navigationDelegate: WKNavigationDelegate?     weak open var uiDelegate: WKUIDelegate?     navigationDelegate = self     uiDelegate = self   func webView(_ webView: WKWebView,          didStartProvisionalNavigation navigation: WKNavigation!) expect this didStartProvisionalNavigation remaining delegates are calling properly .
Replies
2
Boosts
0
Views
5.2k
Activity
Nov ’21
iOS 15 Beta Safari/WKWebView WebPage not loading shows blank screen
In iOS 15 beta 8, Safari/WKWebView is not loading some of the web pages it displays the blank white screen. Is anyone facing the same problem in Safari browser or WKWebview? How to solve this issue, Please help me to move forward on this!!!
Replies
1
Boosts
0
Views
2.6k
Activity
Nov ’21
WKWebView is not asking permission for accessing resource (image or file picker)
In my application, I am using a chatbot inside the WKWebView. Chatbot sometimes asks to upload the image or file and the system provides access to photos and files. I have already included privacy permission in my app even after declining permission webview still can access the resources.
Replies
0
Boosts
0
Views
604
Activity
Nov ’21
Safari Web Inspector do not see my WKWebview on macCatalyst app (without Xcode)
I have a macCatalyst app. I can see the WKWebview pages in the Develop tab of Safari on my Mac when the app is started from Xcode. I can see the WKWebview pages in the Develop tab of Safari on my iPad when started on the device (not started by Xcode) If I start the same app on my Mac but normally this time (not from Xcode), all I get is "No Inspectable Applications". I have set com.apple.security.get-task-allow to 1 like other internet post has suggested, still not working. Please help me, my web colleagues need to be able to debug their webpages in the context of my app running on their mac. My Xcode and macOS is the latest version.
Replies
0
Boosts
0
Views
986
Activity
Nov ’21
EditText in WKWebView is not working on iOS15 but iOS14
Hi everyone, I use the TabView to implement five tabs. And each tab has one WKWebView. Every time I tap the editext from the URL page on WKWEbView, it always jump out and back to the first tab's page. The issue had happened to iOS 14.2. But it was fixed after I upgraded higher iOS version than 14.2 to fix it. Now the issue has happened again since I upgraded the iOS to 15 versions. Does anyone face the same problem like me? Or is there any configuration I need to enable to fix it?
Replies
0
Boosts
0
Views
335
Activity
Nov ’21
Cordova hybrid app latest IOS OS 14.6 and 14.7 wkwebview certain user local storage was cleared
Hi Team, this is one of my Cordova hybird iOS apps in production. Certain users' local storage was suddenly cleared off with the latest IOS versions, such as 14.7 and 14.6. Even though the devices had plenty of storage. Recently, we implemented wkwebview instead of UIWebview. We could not find the cause. Could you please help me locate the cause? Thank you. We are using below configuration: 9.0.0 cordova-lib-9.0.1 ios6.0.0 cordova-plugin-wkwebview-file-xhr 3.0.0 "Cordova WKWebView File XHR Plugin"
Replies
0
Boosts
0
Views
363
Activity
Nov ’21
How to add HTTP headers in request globally for iOS in wkwebview with swift
How to add HTTP headers in request globally for iOS in wkwebview with swift request.addValue only works for the initial url but not for the subsequent URL's.Is there any way?
Replies
1
Boosts
0
Views
1k
Activity
Oct ’21
Can WKWebview store/retrieve the web page resources in Caching Mechanism?
Hello guys, I need to store the resources of WKWebview while loading the web page. Is any other option to store resources? If we are able to store resources, How we will retrieve and use that on the web page while loading?
Replies
0
Boosts
0
Views
652
Activity
Oct ’21
How do i get the whole background to be the same color?
The background behind my HStacks is not the same. Can anyone help? I need to get rid of the black outlines in the HStack. Please and Thank you. import WebKit struct WebView: UIViewRepresentable{       let request : URLRequest       private var webView: WKWebView?       init (request: URLRequest){           self.webView = WKWebView()     self.request = request   }       func makeUIView(context: Context) -> WKWebView{     return webView!   }       func updateUIView(_ uiView: WKWebView, context: Context) {     uiView.load(request)   }   func goBack(){           webView?.goBack()   }           func goForward(){           webView?.goForward()   }       func goHome(){           webView?.load(request)   }       func refresh(){           webView?.reload()   } } struct ContentView: View {               let webView = WebView(request: URLRequest(url: URL(string:  "https://www.itechmania.it/")!))       var body: some View {                       ZStack {       Color.init(red: 0, green: 0.4157, blue: 0.5686 )         .ignoresSafeArea([.all])                       webView                   }                                            HStack{                                      Button(action: {                                               self.webView.goBack()                                             }) {                       Image(systemName: "arrow.backward.circle")                         .font(.title)             .foregroundColor(.white)             .padding()                                   }                   Spacer()                     Button(action: {           self.webView.goHome()                     }) {                       Image(systemName: "house.fill")                         .font(.title)             .foregroundColor(.white)             .padding()                     }                 Spacer()                                                             Button(action: {           self.webView.refresh()                     }) {                       Image(systemName: "arrow.clockwise.circle.fill")                         .font(.title)             .foregroundColor(.white)             .padding()                     }                             Spacer()                               Button(action: {           self.webView.goForward()                     }) {                       Image(systemName: "arrow.forward.circle")                         .font(.title)             .foregroundColor(.white)             .padding()                       }                                                                                      }              .background(Color.init(red: 0, green: 0.4157, blue: 0.5686))                                                 }               } struct ContentView_Previews: PreviewProvider {   static var previews: some View {           ContentView()   }         }
Replies
2
Boosts
0
Views
1.1k
Activity
Oct ’21
How do i get rid of the black background behind my HStack?
I have the Webview in my ZStack and the buttons in my HStack. But i want that background color of HStack to be same as the hstack color. Its black as of now i cant figure out how to do it. Please help
Replies
3
Boosts
0
Views
800
Activity
Oct ’21
In iOS 13, json fetch in js is loading infinitely
After loading jsp url in WKWebView, doing evaluateJavaScript for doing some operations. In there, json files from VM is trying fetch. That is failing. const fetchData = async(path) => { try { let fetchResponse = {} if (path) { const response = await fetch(getURL(path)) const responseData = await response.json(); fetchResponse = responseData; } return fetchResponse } catch (e) { console.log(Error in fetchData ${path}, e) } }
Replies
0
Boosts
0
Views
683
Activity
Oct ’21
Restrict file upload from WKWebview
Is there any callback received at WKWebview when choose file button is tapped? I want to restrict the file upload from WKWebview, I don't want bellow popup to be loaded. I also want to understand which component is responsible for adding this popup ? Kindly help
Replies
0
Boosts
0
Views
957
Activity
Oct ’21
How to call synchronous JavaScript code in WKWebView
How do I, from my objective C cocoa app code, invoke javascript in my WKWebView's page and get a return value without having to over complicate my app and account for other events being processed in between the call to javascript and after it's done? Is this not implemented? I've looked all over the internet and this seems like a highly requested feature with no solution. I understand there may be different processes involved, but process synchronization is done all of the time and doesn't seem like a real technical barrier at least in theory (though I'm not sure what the underlying codebase looks like and what it'd take to get there). Alternative to get to the same problem's solution: before calling evaluateJavaScript, is there a way to disable other events from being concurrently processed until my completionHandler so that I can resume processing events and achieve the same effect? I don't have a depth of knowledge of NSRunLoops, so let me know if that question is exposing some misunderstanding.
Replies
0
Boosts
0
Views
417
Activity
Oct ’21
Screen recording restrictions for default player, playing a video in full screen using webview
How to restrict or close the video played in default player of webview for ios when user starts screen recording? What I have done is!!! In order to achieve data hiding when screen recording is ON, Notification center is used to notify the changes for screen recording. I have used if else condition to check if the screen recording is ON or OFF. Based on above checks i am hiding the window as window.ishidden = true/false With the above condition i am able to restrict user from recording the data present on screen. Failure case: The app is totally on webview. When user clicks on a course it shows the list of videos. When clicked on any of the video it plays with the iOS default player on a full screen. When the user starts on screen recording the window.isHidden = true and user will not be able to see anything on screen. Like wise when the user taps on a video in webview and it starts playing in a full screen and user taps on screen recording the window.isHidden = true but the video still Plays. By showing the window hidden property to true. When I close the player then as the window.ishiddenproperty is TRUE the screen becomes blank with no content visible. Please do help me with this as i am using webview which loads up the data and player might be on top of window element.
Replies
0
Boosts
0
Views
784
Activity
Oct ’21
iOS 15 WKWebView unexpected microphone behaviour while displaying website from local storage
Our app displays a website from local storage (meaning our WKSecurityOrigin protocol is file, not https) which connects to a local Asterisk server over wss://* in order to make and receive Sip calls from and to intercroms in the users local network. The sip connection works as expected and we're able to make and receive calls. After we've established voice communication to an intercrom, we're able to receive and play the audio information from the other party but we aren't able to send any audio information back from our iOS device. The WebView doesn't display any errors and we're able to access navigator.mediaDevices.getUserMedia without any problems. It's like the microphone on our iPhone was muted (which isn't the case though, our WKMediaCaptureState is Active). If we load the same website from https://, this problem disappears and the other party is able to hear us. We also handle the microphone permission request with this rudimentary code in our WebView: - (void) webView:(WKWebView *)webView      requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin      initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type      decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler      API_AVAILABLE(ios(15.0)) {   if (type == WKMediaCaptureTypeMicrophone) {     decisionHandler(WKPermissionDecisionGrant);   } } Previously we just relied on the user clicking "Allow" in the popup which asked if they'd accept the app accessing the systems microphone. Either way, microphone access, if granted, shouldn't be the issue here. We've also built a testing website to see what the data received from the microphone looks like in the WebView. By implementing this we can see, that the data chunks received from the MediaRecorder are empty while loading from file and contain data while loading from https. This tells us that once again, iOS treats file contexts differently from https even though they're both considered equally secure contexts. Our setup was working after this was fixed in iOS 14.5 now it's once again broken and we have no idea why. We don't know if the WebView behaves the same towards camera access. We'd be glad if somebody could tell us if this was expected behaviour and how iOS is going to treat the file context in the future. We rely heavily on displaying our website from local storage because the website allows the used to control their home and we don't want to download this potentially large website every time they open our app since reducing interaction time is key here. *to securely connect to the local server we installed the root CA with which the Asterisk's server cert was signed on our iOS system, this results in the WebView trusting our Asterisk server and allowing secure connections to it
Replies
0
Boosts
0
Views
1.7k
Activity
Oct ’21
WKWebView is not showing error message for unknown host
Hi, I am using WKWebView to showing some web content to user in my application. it is working fine for valid url. but when I try to load a request for invalid url it's show an empty view and getting an error in didFailProvisionalNavigation delegate method. but in other side SFSafariViewController shows an error message for invalid url. like "Safari cannot open the page because the server cannot found" is it any configuration/api for WKWebView so we can achieve the same behaviour like SFSafariViewController for invalid url? means, show the error message instead of blank screen.
Replies
0
Boosts
0
Views
791
Activity
Oct ’21
javaScriptCanOpenWindowsAutomatically feature not avaialble with WKWebpagePreferences
javaScriptCanOpenWindowsAutomatically feature is available with WKPreferences As WKPreferences.javaScriptEnabled got deprecated, it is recommended to migrate with WKWebpagePreferences . But as the dependent javaScriptCanOpenWindowsAutomatically is not available in WKWebpagePreferences blocking our functionality.
Replies
1
Boosts
0
Views
733
Activity
Sep ’21
"Selected Date", Reset, Ok buttons, previous and next and icons on not visible.
Hello Apple Team, As described in the subject and from the attached screenshot we are not seeing the labels, icons, and selected date in the date picker for iOS version 14.0 and above. We are using WKWebview to load the forms, using HTML tag input type="date"> to show the date picker. Environment Details: xCode version 12.4 Swift version 5.0. The app is developed in native iOS. We tried different ways to fix this issue but to no avail. Guide us to fix this, as it is a production issue. Let us know for any other clarifications, waiting for your response ASAP.
Replies
0
Boosts
0
Views
757
Activity
Sep ’21
iOS 15 WKWebview evaluateJavaScript API does not work for accessing "window.subObj"
We call webView evaluateJavaScript:javaScript completionHandler:^(id _Nullable result, NSError *_Nullable error) API to inject a javascript to WKWebView. The javascript contains "window.xxx"definition. Since iOS 15, "window.xxx" can not be found and it will return "undefined" when accessing "window.xxx" . It seems that javascript "window" object can not have any custom sub-object. However same javascript code works fine on iOS 14.x and below. Any ideas? Thanks!
Replies
4
Boosts
0
Views
3k
Activity
Sep ’21
WKWebview.evaluateJavaScript doesn't return when disconnect the internet.
Below is my code: let loginButton = "document.getElementById('loginButton').click()" webView.evaluateJavaScript(loginButton) { result, error in print(result, error) } It works fine when the device has internet. But before calling this func, I turn off the internet, the func is called but nothing returned. Can I set a timeout for this func or get a callback error from anything to know there is an error. Thanks.
Replies
0
Boosts
0
Views
401
Activity
Sep ’21