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

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Mysterious error when using a WKWebView in an InputMethodKit app
I modified an InputMethodKit example (fairly recent one from github, compiled fine and worked as expected on my machine as it was) to create a window with a WKWebView and the window doesn't load. I know that loadView is getting called, but the window never appears after calling showWindow on the window controller and there is a mysterious error in the console: bootstrap_check_in(): (os/kern) unknown error code (44c) From googling this it seems App Sandbox related, but I think I have everything set up correctly (App Sandbox on with outgoing connections allowed) Totally stumped, any help or ideas would be appreciated Here's the relevant code: View controller import Foundation import WebKit import AppKit class InputWindowViewController: NSViewController, WKUIDelegate { var webView: WKWebView! override func loadView() { NSLog("LoadView") webView = WKWebView() self.view = webView webView.uiDelegate = self webView.needsDisplay = true } override func viewDidLoad() { super.viewDidLoad() webView.load(URLRequest(url: URL(string:"https://www.apple.com")!)) } } Window controller import AppKit import Foundation import WebKit class InputWindowController: NSWindowController { var controller: InputWindowViewController? override init(window: NSWindow?) { controller = nil super.init(window: window) } override func loadWindow() { self.window = NSWindow(contentViewController: controller!) } required init?(coder: NSCoder) { controller = nil super.init(coder: coder) } } AppDelegate import Cocoa import InputMethodKit import WebKit // Necessary to launch this app class NSManualApplication: NSApplication { private let appDelegate = AppDelegate() override init() { super.init() self.delegate = appDelegate } required init?(coder: NSCoder) { // No need for implementation fatalError("init(coder:) has not been implemented") } } @main class AppDelegate: NSResponder, NSApplicationDelegate { var server = IMKServer() var candidates = IMKCandidates() var inputWindowController = InputWindowController() func applicationDidFinishLaunching(_ notification: Notification) { // Insert code here to initialize your application server = IMKServer(name: Bundle.main.infoDictionary?["InputMethodConnectionName"] as? String, bundleIdentifier: Bundle.main.bundleIdentifier) inputWindowController = InputWindowController() inputWindowController.controller = InputWindowViewController() inputWindowController.loadWindow() inputWindowController.showWindow(self) candidates = IMKCandidates(server: server, panelType: kIMKSingleRowSteppingCandidatePanel, styleType: kIMKMain) NSLog("tried connection") } func applicationWillTerminate(_ notification: Notification) { // Insert code here to tear down your application } } This code is probably awful in a lot of other ways I don't realize, but I wanted to get a webview window up before I put a bunch of time into this thing XCode 13.4 MacoOS 12.7.4
1
0
384
Apr ’24
Webview in iOS 17.4.1 performance issue
Hi all, An app that until yesterday would take 1 second to render a list in the WKWebView is now taking over 3 minutes to load. No changes have been made to the app or the content that it is showing. I have tested on a device running 17.3, and performance has been acceptable, and then updated to the latest security fix (17.4.1) and now 3 minutes. Having read the release notes https://support.apple.com/en-us/HT214097 I cant see what would have affected either the processing of javascript or the rendering of content within the web view. My team is currently running all our apps that use a hosted WKWebView within it to ensure that they aren't affected, but this one app is now unusable and safety concern for the users (Airline Safety). Has anyone else experienced this or has a workaround - Sorry there are no logs (I have been scanning the device logs and nothing new is appearing - almost as if the operation is just dead locked).
4
0
1.6k
Apr ’24
My app uses web view to load html data within app. Is that needs App Tracking Transparency?
Hello, Currently, my app only uses web view to load HTML data and external safari web view by link click. I have seen the following developer's details. So if HTML data load on web view needs data collection enabled, then which Types of data need to be added to data collection? Also. if we disable all types of Data collection from privacy. Is apple will allow you to submit the app? or Reject it? Any help will be appreciated. Thanks
0
0
384
Apr ’24
NSPrivacyTrackingDomains and WebView based functionality
Hello Apple We have read your guide on https://developer.apple.com/documentation/bundleresources/privacy_manifest_files#4284009 and it is unclear how the NSPrivacyTrackingDomains affects WebView functionality of the app. We have WebView based functionality we use for signup/ login of customers in the app and that can potentially track users. It is stated that If the user has not granted tracking permission through the App Tracking Transparency framework, network requests to these domains fail and your app receives an error. However based on our testing the domains listed in NSPrivacyTrackingDomains have no effect on network requests happening in the WebView if the user declines tracking via the App Tracking Transparency prompt. (e.g pages are loaded, network requests to listed tracking domains are happening) Can you confirm it is the case on what should de done about it? Right now we have a custom implementation on our side that passes the result of the App Tracking Transparency prompt to the WebView instructing it weather it can send requests to tracking domains or not.
0
0
461
Mar ’24
WKWebView loadSimulatedRequest() method
Is there any reference/documentation/discussion about the motivation for including the WKWebView loadSimulatedRequest() method? Is it intended to be used for testing? Page load performance enhancement? I'm wondering if there is a way to leverage its usage in our webview dependent app.
0
0
279
Mar ’24
Azure B2C cookies missing on Safari 17.x
Our app uses Azure B2C for SSO login, and we are noticing a bug on Safari 17.x (any browser on iOS 17.x, and Safari 17 on Mac OS) where the Azure B2C cookies go missing during the registration process, which leads to a broken user experience. The following cookies are the ones that go missing The only forum posts related to this issue I have come across are these: https://techcommunity.microsoft.com/t5/azure/azure-app-on-ios-17-not-working/m-p/3958809 Which links to this https://techcommunity.microsoft.com/t5/intune-customer-success/day-zero-support-for-ios-ipados-17-and-macos-14/ba-p/3930010 Is this in bug that will be fixed in an upcoming release on Safari 17.x?
0
0
421
Mar ’24
WKWebView "showLockdownModeFirstUseMessage" delegate
How exactly am I supposed to implement the following delegate method of WKWebView? func webView(_ webView: WKWebView, showLockdownModeFirstUseMessage message: String, completionHandler: @escaping (WKDialogResult) -> Void) The problem: the delegate method is defined to be available since iOS 13. But "WKDialogResult" in the completion handler is declared to be available since iOS 16. So this is already very odd and probably a bug in the API declaration. When I make the delegate method available since iOS 16 (via @available (iOS 16.0,*)) then Xcode gives me an error stating that this method must be provides for iOS 14 and later. But when it is made available since iOS 14 (or 13), then I get the error that WKDialogResult is only available since iOS 16. So this looks like a big messy bug in the API declaration, or did I miss something here? It would not the first bug in the API declaration of the WKWebView where the availability is wrong (for example the property "upgradeKnownHostsToHTTPS" is declared to available since iOS 14.5, but in reality it is only available since iOS 16 and would crash when used under iOS 14.5)
0
0
245
Mar ’24
Enable service worker selectively
In my app, I have several WKWebViews. The WKWebViews communicate to javascript by installing userscripts. Now one of those webviews, wants to enable support for service workers, which is not required in the other instances of WKWebView. So what I thought, is that I only enable in this WKWebView instance the service worker, which sets limitsNavigationsToAppBoundDomains in its WKWebViewConfiguration to true. And so the service worker is enabled and works fine and also my WKUserScript works fine. In the other WKWebView instances I thought, that I would simply set limitsNavigationsToAppBoundDomains to false and the service worker would be disabled and WKAppBound domains from the Info.plist would be ignored. Unfortunately my WKUserScript now stopped working. :-( How can I achieve that? Does the presence of WKAppBound domains in the Info.plist mean, that I MUST set limitsNavigationsToAppBoundDomains to true for my WKUserScript to work? Or am I on the completely wrong track? Any help is greatly appreciated, because I am pretty much stuck with this issue and I need to solve it, because the limitation to 10 domains from WKAppBoundDomains carries the risk to break the webview. In that webview payment is provided and the payment provider might at any time change dependencies to another domain (as happened recently, which broke the payment page) Best regards Alex
1
0
434
Mar ’24
audio ios 17.4 webview
Hello, my radio streaming app worked well in iOS 17.2 and earlier but from iOS 17.4 streaming no longer works, what has changed? What do I have to do in my app? import UIKit import WebKit class ViewController: UIViewController, WKNavigationDelegate { @IBOutlet weak var mWebView: WKWebView! private let url: URL = URL(string: "https://mi web")! override func viewDidLoad() { super.viewDidLoad() let configuration = WKWebViewConfiguration() // Configurar preferencias de la página web let preferences = WKPreferences() preferences.javaScriptEnabled = true configuration.preferences = preferences mWebView.navigationDelegate = self mWebView.load(URLRequest(url: url)) } }
0
0
310
Mar ’24
WKWebView iOS: Double-tapping the space bar doesn't insert a period.
Even when iOS's '"." Shortcut' keyboard setting is enabled, double-tapping the spacebar in WKWebView doesn't insert a period. While making WKWebView editable , "." shortcut is not working. It works fine when any other external keyboard is used. I am facing this issue in WKWebView using apple keyboard. Even forceful adding javascript to replace double tap of space bar to period character logic is not working.
0
0
504
Mar ’24
PDF Text recognition in WKWebView iOS 16 iOS 17
Problem: Hello! I have some problems with UIEditMenuInteraction in WKWebView which show PDF using PDFKit (as far as I know) - when text is selected, there is no copy/paste buttons on iOS 16.4 or higher. Also I've noticed that selection blue view take less space than actual text is on iOS 17. The problem both cyrillic and latin characters. How I can fix this? p.s. I found on stackoverflow that PDFKit can treat PDF files like images, but on view hierarchy there is no differences between 16 and 17 iOS How it looks: The problem file: https://drive.google.com/file/d/1Tu8RCrlwOI_H3TcwOGFbDR0G9h1OP7MU/view?usp=sharing
0
0
356
Mar ’24