Explore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.

General Documentation

Post

Replies

Boosts

Views

Activity

Safari Responsive Design Mode Simulators are not showing up.
I have simulators downloaded to my 14" M2 Pro Macbook Pro, and for some reason, I cannot see any simulators as an option in Safari's Responsive Design Mode. Am I missing something obvious, or is my computer bugged? Above is an image of the Responsive Design Mode showing no simulators. I would offer more screenshots to prove that I have simulators installed, but it won't let me upload any more photos for some reason.
23
10
5.9k
Sep ’23
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.
4
1
922
Nov ’23
SFSafariWindow.getAllTabs method will not get suspended tabs
To reproduce this bug: Create a simple Safari App Extension using the SFSafariWindow.getAllTabs method Open a few tabs in Safari and save them to a named tab group Quit Safari with Command + Q Open Safari and navigate to the saved named tab group (do not navigate to other tabs, those non-active tabs will be suspended until we navigate to them) Trigger the SFSafariWindow.getAllTabs method in our Safari App Extension Ideally we should get all tabs in the tab group of the window, but instead we only get the active tab Did I miss anything to make it work as expected?
2
0
713
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
362
Nov ’23
Touch event capture method or API for ios
I want to develop the application where I can able to capture and send the touch events like TAP,Press,Swipe etc from iphone to browser(Client) for remote support .can anyone suggest any method or API to capture Touch Events and the method to send on browser. Is there any document or link is available or support for the same
0
0
492
Nov ’23
JavaScript reload of PWA after navigating back from external link
I'm developing a PWA for mobile Safari. Here is a video of the problem that I have: https://share.icloud.com/photos/068xNZvHZqAQI83EP5FHJj8ag I open the app. It's like a Hacker News or Reddit clone so users always navigate away to external links. The external link gets opened in this overlay, which I really like, that's great However, when I press "done", you can see how the page somehow re-evaluates the JavaScript. E.g. the "voting errors" start pulsating which means that the page re-fetches some data from the server, which IMO isn't strictly necessary as the page was fine without that I noticed that this isn't happening if I e.g. have the page open in a tab on regular Safari. When I then navigate to the tab, it doesn't reload JUST the JavaScript What I also find weird about this is that it seems to only reload the JavaScript, not the entire page. My site is at https://news.kiwistand.com/ so you can test this for yourself. The source code of the frontend is here https://github.com/attestate/kiwistand/tree/main/src/web and here's the PWA manifest https://github.com/attestate/kiwistand/blob/main/src/public/pwa.json My question: Is there a way I can stop Safari from "reloading" the JavaScript when navigating back from an external link?
1
1
464
Nov ’23
Safari on MacBook doesn't send http/2 WINDOW_UPDATE frame
Hello Sirs, I've developed http/2 server, tested with nghttpx, Edge, Mozilla, Chrome web browsers, all seems to be fine. As I navigate to an url under my http/2 server with Safari browser (ver 17.^) on MacBook 2023, the server is catching WINDOW_UPDATE frame for stream id 0, but unfortunately no WINDOW_UPDATE frames with specific stream Id are sent from Safari http/2 specification tells, that this frame for stream id 0 isn't yet enough to be allowed to send DATA frames to browser. The concrete stream id is needed in WINDOW_UPDATE frame. The INITIAL_WINDOW_SIZE setting of the SETTINGS frame from Safari is only 100 bytes. I just send the response SETTINGS frame with ACK flag set true, not trying to increase this setting's value. Now the server just sends first DATA frames for each stream, and Safari fetches them, renders and shows in browser, however the streams' window sizes are exhausted. But I'm not risking pushing all DATA frames of larger files, so that other browsers then don't RST these streams. Any infos for me please about specific Safari http/2 frames flow?
2
0
522
Nov ’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
518
Nov ’23
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
617
Dec ’23
BlockStoragePolicy on Safari
My team is attempting to use an an add-in for Outlook for Mac that stores a Microsoft account access credentials in safari, so that it can refresh the credentials in the background and not force users to manually re-login every time the credentials expire. The update to safari that prevents local storage has prevented this from working correctly. It appears that the local storage prevention policy can be disabled with this command: 'defaults write com.apple.Safari BlockStoragePolicy -bool false' This initially seemed to work but no long seems to be allowing the credentials to be stored. I was unable to find any documentation as to what exactly this command does. I wanted to see if anyone knew exactly what this command does and if there is a variation or alternative command that would make local storage in safari allowed again.
0
0
337
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
3.3k
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
660
Dec ’23