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

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Crash entering Picture in Picture from webview on Mac Catalyst or Made for iPad
Crash seems to be in a private Apple framework. There's some other reports of this floating around but no solutions so far. Any ideas? *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WebAVPlayerLayer startRedirectingVideoToLayer:forMode:]: unrecognized selector sent to instance 0x6000037033c0' *** First throw call stack: ( 0 CoreFoundation 0x0000000187d56800 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000018784deb4 objc_exception_throw + 60 2 CoreFoundation 0x0000000187e083bc -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x0000000187cc0a84 forwarding + 1572 4 CoreFoundation 0x0000000187cc03a0 _CF_forwarding_prep_0 + 96 5 AVKit 0x00000001bdc81f30 -[__AVPlayerLayerView startRoutingVideoToPictureInPicturePlayerLayerView] + 156 6 AVKit 0x00000001bdcf1d48 -[AVPictureInPicturePlatformAdapter(Common) _setRoutingVideoToHostedWindow:pictureInPictureViewController:source:] + 84 7 AVKit 0x00000001bdcd952c -[AVPictureInPicturePlatformAdapter startPictureInPicture] + 380 8 AVKit 0x000000022883000c -[AVPictureInPicturePlatformAdapterAccessibility startPictureInPicture] + 44 9 AVKit 0x00000001bdcddea0 -[AVPictureInPictureController startPictureInPicture] + 216 10 WebCore 0x00000001c75277c8 -[WebAVPlayerViewController startPictureInPicture] + 128 11 libdispatch.dylib 0x0000000102c64f14 _dispatch_call_block_and_release + 32
2
0
577
Dec ’23
Headphones issue with WKWebView video streaming IOS 17+
Hi, the application I maintain consists of WKWebView which gives you the ability to stream videos. Since iOS 17, when you disconnect the headphones on iPad, the stream stops working and cannot be restarted (regardless of whether it is the lightning or jack port). The only solution is to kill the application from the task manager and start it again. This situation does not occur for regular video. There is no error logs in console.
0
0
251
Dec ’23
DerivedData acting weird
I am creating a capacitor app. I just added firebase to the project and noticed that after deleting the DerivedData manually in the terminal rm -rf ....../DerivedData and cleaning the build inside the build folder, I am having issues with creating a new DerivedData. This is from sync with the capacitor plugin. I get an error when syncing: error: Could not delete /Users/sebastianruano/Library/Developer/Xcode/DerivedData/App-gdqaqcstdfdnpmcwgplouxwouxcf/SourcePackages/checkouts/nanopb/build because it was not created by the build system. note: To mark this directory as deletable by the build system, run xattr -w com.apple.xcode.CreatedByBuildSystem true /Users/sebastianruano/Library/Developer/Xcode/DerivedData/App-gdqaqcstdfdnpmcwgplouxwouxcf/SourcePackages/checkouts/nanopb/build when it is created. error: Could not delete /Users/sebastianruano/Library/Developer/Xcode/DerivedData/App-gdqaqcstdfdnpmcwgplouxwouxcf/SourcePackages/checkouts/nanopb/build because it was not created by the build system. note: To mark this directory as deletable by the build system, run xattr -w com.apple.xcode.CreatedByBuildSystem true /Users/sebastianruano/Library/Developer/Xcode/DerivedData/App-gdqaqcstdfdnpmcwgplouxwouxcf/SourcePackages/checkouts/nanopb/build when it is created. Is it safe to run this command: xattr -w What do you recommend?
1
0
375
Dec ’23
Safari Fairplay WebKitMediaKeyError (code: 6, systemCode: 4294955417)
Hi Apple Team, we are observing following error intermittently when trying to playback FairPlay protected HLS streams. The error happens immediately after loading the certificate. Playback with same certificate on same device(Mac, iPhone) works most of time but intermittently this error is observed with following codes. The code=6 means MEDIA_KEYERR_DOMAIN but I did not find any information on what does systemCode=4294955417 mean? Is there a way to check what does this system code mean and what could be causing this intermittent behaviour? { "code": 6, "systemCode": 4294955417 }
1
0
613
Mar ’24
Remote server seeing iPadOS web app as iPadOS 10
I have an Xcode iPadOS WebKit app in which the remote web site is detecting the OS as iPadOS 10 from my app. The test iPad is running iPadOS 17.1.2. In regular Safari on the same iPad, the site works fine. I was trying to find a way to hard set the iPadOS version but I can not seem to track down the code for this to add to my app. Can the version of the web browser also be hard set for a WebKit app? Thanks!
1
0
272
Dec ’23
Can a WKWebView hosting an "HTTPS" url listen to a "LocalHost WebServer" via a "WebSocket Connection" in an iOS Application?
Problem Description: In the current scenario, I am dealing with a website platform that lacks traditional APIs for service access. To circumvent this limitation, the mobile application necessitates hosting a "web server" locally on "ws://127.0.0.1:****". The idea is that the website, loaded in a WKWebView, should establish a WebSocket connection with the locally hosted server. The responsibility for creating this WebSocket lies with the loaded website. I am utilizing "Telegraph" to set up the local server within the iOS application. To verify the functionality of the local Webserver, I attempted to establish a WebSocket connection to it outside of the WKWebView, and the connection was successfully established. Question: Despite the success of the direct WebSocket connection outside of WKWebView, I am encountering difficulties when attempting to establish the same connection within the WKWebView. Is this approach even feasible? If it is, could you kindly point out any potential oversights or provide guidance on what might be missing in my implementation? Your assistance in resolving this matter is greatly appreciated.
0
0
536
Dec ’23
WKWebView throws RBSServiceError when multiple SwiftUI views are created
Description I've seen this issue when I use WKWebView in SwiftUI. If I have 2 web views at once in a SwiftUI view, it produces unwanted console warnings that seem to be not solvable on client side. The warnings aren't present when there is only 1 web view. Similar warnings regarding the "running board" or RBSAssertionErrorDomain are reported by others as well. Please advice how to dismiss these warnings in the app. Thank you. Repro Steps and Code Create a new iOS project. Put the following code into ContentView.swift. It wraps a WKWebView in SwiftUI and display some dummy html data in the web views. Build and run the app. Tap the info button. Drag down or dismiss the sheet. Upon dismiss, in the console it prints the error messages attached below. import SwiftUI import WebKit struct ContentView: View { @State private var isInfoViewPresented = false @State private var selectedIndex = 0 func makeErrorHTML(index: Int) -> String { #"<!doctype html><html><h1 style="text-align: center;">Unable to display README.</h1></html>"# } var body: some View { VStack(spacing: 8) { Text("Hello, world!") Button { isInfoViewPresented = true } label: { Image(systemName: "info.circle") .imageScale(.large) } .sheet(isPresented: $isInfoViewPresented) { sheetContent } } } var sheetContent: some View { NavigationStack { ZStack { WebView(htmlString: makeErrorHTML(index: 0)) .background(Color(uiColor: .systemGray)) .opacity(selectedIndex == 0 ? 1 : 0) WebView(htmlString: makeErrorHTML(index: 1)) .background(Color(uiColor: .systemGray2)) .opacity(selectedIndex == 1 ? 1 : 0) } .toolbar { ToolbarItem(placement: .principal) { Picker("Information Mode", selection: $selectedIndex) { Text("0").tag(0) Text("1").tag(1) } .pickerStyle(.segmented) } ToolbarItem(placement: .confirmationAction) { Button("Done") { isInfoViewPresented = false } } } } } } struct WebView: UIViewRepresentable { /// The HTML to load in the web view. let htmlString: String func makeUIView(context: Context) -> WKWebView { // Creates an empty web view. let webView = WKWebView(frame: .zero) // Sets the web view's navigation delegate. webView.navigationDelegate = context.coordinator return webView } func updateUIView(_ webView: WKWebView, context: Context) { // Loads the given HTML string. webView.loadHTMLString(htmlString, baseURL: nil) } func makeCoordinator() -> Coordinator { Coordinator() } class Coordinator: NSObject, WKNavigationDelegate { func webView( _ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void ) { switch navigationAction.navigationType { case .linkActivated: if let url = navigationAction.request.url, UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } decisionHandler(.cancel) default: decisionHandler(.allow) } } } } OS Version iOS 15 - iOS 17 Simulator and Device Xcode Version 15.0.1 (15A507) macOS 14.1.1 (23B81) Similar Posts @eskimo shared information about runningboard in this post: https://developer.apple.com/forums/thread/702207 https://developer.apple.com/forums/thread/709919 https://stackoverflow.com/questions/69902932/error-acquiring-assertions-what-is-that https://developer.apple.com/forums/thread/708801 Error From Console 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}> 0x11e024780 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=85,796, 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=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> 0x11e0247e0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=85,796, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist} 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}> 0x11e0248a0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=85,797, 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}
2
0
2.2k
Feb ’24
WKWebview with external keyboard behaviour
Currently I am using Objective-C and embedding a React website into the WKWebview. I have a component with scroll function and I also have some text description with an input component in the scroll function component. If the input component is shown all and I onClick the input component for inputting value in it, it works normally. However, when the input component shows only half of it and another half is hidden by the scroll component (Because it scrolls to see only half of the input component), it will triggers an unexpected issue that the WKWebview will have a white bar on the bottom and it will keep exists and affecting my UI. I have checked with web inspector that it is outside of the tag. Therefore, seems it is related to the issue with the external keyboard behaviour. Please provide some suggestion if anyone have any idea on this topic. Thanks a lot
0
1
501
Dec ’23
Completion handler passed to -[NSObject webView:decidePolicyForNavigationAction:decisionHandler:] was not called
Hi! I'm having this crash on the app, it only happens in production and I haven't been able to reproduce it. I attacedh the full crash report and here is the code for the decidePolicyForNavigationAction action: func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { guard let url = navigationAction.request.url else { decisionHandler(.allow) return } var policy: WKNavigationActionPolicy = .allow if (["tel", "sms", "facetime"].contains(url.scheme) || navigationAction.navigationType == .linkActivated && initialUrl.host != url.host) && UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) policy = .cancel } decisionHandler(policy) } Can someone help me find out what could be then cause for this isse? CrashReport
0
0
372
Nov ’23
Inquiry and Feedback on Captive Portal Google Authentication in iOS, macOS, and iPadOS
Hello Apple Developer Community, I have been investigating the challenges with captive portal authentication on Apple devices, particularly regarding Google's OAuth 2.0 authorization in embedded WebViews and the resulting disallowed_useragent error. For Wi-Fi networks providing a captive portal with a 'Sign in with Google' option, reconnecting to the network after forgetting it triggers the portal page. However, attempting to sign in with Google results in an error. Additionally, on macOS Sonoma 14.1.1, clicking the Google Authenticate button elicits no response. I recently discovered that this issue has been resolved in an iPad Pro updated to iOS 17.1.1. However, I've also tested with an iPhone 7 running iOS 15.4.1 and found that the issue persists on this version. Could you provide information on which versions of iOS, macOS, and iPadOS have addressed this issue? It would be immensely helpful for developers and users to know from which version onwards this fix has been implemented, ensuring a consistent and secure experience across Apple platforms. Thank you for your assistance and looking forward to your response.
0
1
463
Nov ’23
WKWebView stops responding when navigating to simple web page that contains external JavaScript
The WKWebView in my application runs flawlessly and executes all the JavaScript of the websites visited. However, if I call up a very simple web page that contains nothing more than a text and a reference to the external JavaScript file "https://code.jquery.com/jquery-3.7.1.min.js", which is nothing unusual, then the WKWebView freezes and no longer responds. The NSAllowArbitaryLoads in Info.plist is set to true. I have checked all configarations and all callbacks of WKNavigationDelegate, but found no way to allow or disallow the external JavaScript. If in my test the JavaScript is loaded from the same server, it works. This is just a test to reproduce the error. I cannot influence the website that I actually want to display in WKWebView.
0
0
269
Nov ’23
jQuery modal dialog popup not showing in WKWebView
Hi, I have a WKWebview to open the client's website. In the website, there is a "Cancel" button that will open a popup for confirmation. In Safari or other web clients, it works and it will open a popup. But in my iOS app, it didn't. When I ask the web FE developer, he said that he is using jQuery modal dialog for the popup. I tried using this, but doesn't work: class WebsiteViewController: UIViewController { var urlRequest: URLRequest? @IBOutlet weak private var ibWebView: WKWebView! override func viewDidLoad() { super.viewDidLoad() ibWebView.configuration.websiteDataStore = .nonPersistent() ibWebView.configuration.preferences.javaScriptEnabled = true ibWebView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true ibWebView.navigationDelegate = self ibWebView.uiDelegate = self loadInternetBanking() } private func loadInternetBanking() { guard let urlRequest = urlRequest else { return } ibWebView.load(urlRequest) } } extension InternetBankingViewController: WKUIDelegate { func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { print(":::::::: createWebViewWith!!!!") //- this doesn't get called let popupWebView = WKWebView(frame: view.bounds, configuration: configuration) popupWebView.autoresizingMask = [.flexibleWidth, .flexibleHeight] return popupWebView } func webViewDidClose(_ webView: WKWebView) { } func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async { print(":::::::: runJavaScriptAlertPanelWithMessage!!!!") //- this doesn't get called } func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async -> Bool { print(":::::::: runJavaScriptConfirmPanelWithMessage!!!!") //- this doesn't get called return true } } The createWebViewWith, runJavaScriptAlertPanelWithMessage, and runJavaScriptConfirmPanelWithMessage callbacks are not being called. Can you help me with this? Thank you.
1
0
520
Nov ’23
Error with Download Container on iPadOS17 and Xcode15
From Xcode15, when Download Container in Window > Devices and Simulators for iPadOS17, an error occurs. The specified file could not be transferred. Domain: com.apple.dt.CoreDeviceError Code: 7000 User Info: { DVTErrorCreationDateKey = "2023-11-21 05:52:37 +0000"; NSURL = "file:///Users/administrator/Desktop/<bundle identifer>%202023-11-21%2014:52.14.006.xcappdata/AppData/Library/WebKit/WebsiteData/IndexedDB/v0"; } -- Performing a file system operation failed: Failed to open Library/WebKit/WebsiteData/IndexedDB/v0 for reading, openat(2) returned POSIX error code 62 (parentParam = 51) Domain: com.apple.dt.remoteservices.error Code: 11001 -- Failed to open Library/WebKit/WebsiteData/IndexedDB/v0 for reading, openat(2) returned POSIX error code 62 (parentParam = 51) Domain: NSPOSIXErrorDomain Code: 62 Failure Reason: Too many levels of symbolic links -- System Information macOS Version 14.0 (Build 23A344) Xcode 15.0.1 (22266) (Build 15A507) indexedDB is not used in the app. I was able to download successfully with Xcode15 and iPadOS16. I was able to download successfully with Xcode14 and iPadOS17. Why do I get an error with Xcode15 and iPadOS17?How should I fix it? That you.
9
2
1.9k
Apr ’24
Why does text selection not work in MacCatalyst app's WKWebView on macOS Sonoma Only
Can not select anything within WkWebView editor view of my MacCatalyst app when running on macOS 14 Sonoma. Any selection gesture or command key fails to select anything in content editable WKWebView, so none of the Editor tools can be activated. My application uses the nnhubbard / ZSSRichTextEditor WKWebView-based Rich Text Editor: https://github.com/nnhubbard/ZSSRichTextEditor. The app is built with Xcode 15.0 or 15.0.1. The app is a Catalyst app that implements an editor view with a ZSSRichTextEditor WKWebView. The problem does not occur if the the app is run in iOS or macOS 11, 12, or 13 (Catalina, Monterey, or Ventura.) The issue only occurs in macOS 14 Sonoma.
2
1
609
Nov ’23
Data is getting truncated at the page end and displaying other half in next page in a Pdf render. This issue is reproducing only on ios 17 version ipads wheere data is loading with wkwebView.
I need help for this issue which is happening only in ios 17 ipad devices. I have an application which generates report in a pdf form. We are loading the html file as a string to webkit webView which is further helping us by generating the content in pdf format. our report contains rows & columns which uses div tags and few css properties. If we view the report which is in pdf form, the data is getting truncated for a row horizentally at the page end and displaying the remaing truncated data in the next page. This issue is happening only in ios 17 updated devices. It was working fine and displaying the data correctly with same html content. Please let me know any possible ways through which I can resolve this issue. I have tried few properties like page-break-X(inside,before,after)- avoid; margin-bottom, padding etc...nothing worked for me.
0
0
503
Nov ’23
Safari browser on iPhone 14 Pro (ios 17.1), Web Speech API encountered problems after Bluetooth speaker connection
Problems when connecting Bluetooth speakers on iOS devices. When trying to use the Web Speech Api -(Text-To-Speech) in safari immediately after connecting to a Bluetooth speaker, it playing the sound using the phone's speakers instead of the connected Bluetooth speaker's. Then, when I summon Siri and briefly use the voice function, the Web Speech API in the web browser uses the Bluetooth speaker, and it works. It seems that there may be some kind of limitation or issue when switching between Bluetooth devices and voice apis.
1
0
471
Nov ’23
Expected Behaviour of windows appearing when app is full-screened
Hi folks, Got a question on the behaviour of apps when they are in full screen mode, and moreso, when another app tries to show itself. For example, if app A is open and in fullscreen mode, I cannot drag a window from app B (that is not in full screen mode) on top of it. However, I can drag another window from app A (that is not in full screen mode) on top of it. With that said, programtically, I can open a window from app B on top of app A (despite app A being full screened). Is there documentation on the specific rules with regards to an app in full screen, and similarly, an app in tiled full screen (ie split full screened). Trying to understand if the programatic opening of app B window on top of app A (fullscreened) is expected, or a bug, given that manually dragging isn't allowed. Thanks!
0
0
216
Nov ’23