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

All subtopics

Post

Replies

Boosts

Views

Activity

Safari Web Extension runs fine on Simulator, but not on Device
I am writing this Web Extension for Safari. It is designed to run on both macOS and iOS. The extension-specific javascript/css/etc files are shared between the platforms. What I observe is that the extension is running fine on macOS. It also runs fine on the iOS Simulator. However, on my device, just nothing happens when activating the extension. No errors are output to the console either. I found it out the hard way, when I already released the extension in the AppStore, and installed it on a friend's iPhone. Does anyone have a clue where I even could start debugging? Or better: maybe there is just a simple checkbox that that I should (un)check?
0
0
58
1d
Camera accessing from sfsafariviewcontroller on IPhone 15 Pro
Hello, I am building a React webapp that will be opened in a webview (sfsafariviewcontroller) within an app. This simple app uses a camera to scan a barcode and get the hidden special price. During the QA test, we found that it does not work on iphone 15 pro while it works fine on other iphone series including iphone 8 plus, iphone 13, iphone 14, iphone 14 pro max. I updated IOS version to the latest on my iphone 14 pro max to match with the IOS version on iphone 15 pro, it still works fine on 14 pro max. So I think it could be an issue with the device version maybe with more privacy configuration or something else. In the app, there is another barcode scanner (using camera) and it works fine on the same device, but the scanner within the sfsafariviewcontroller shows a white blank screen. The red camera icon at the top is shown for a while and disappeared. Does anyone have the same issue? We specified the NSCameraUsageDescription in the info.plist. Any advice would be greatly appreciated!
0
0
86
1d
Import a debit/credit card directly from a web app into the iPhone's wallet
Hi, I know it's currently possible to import a virtual debit/credit card from a mobile app into the IOS Wallet using PassKit from the Apple SDK, but I haven't seen any documentation to do it directly from a web app, could you please tell me if it is possible to do it directly from a web app without using a mobile app? And if so, point me to some documentation? Thanks in advance
1
1
95
2d
JS error in WKWebView
I received this JS error: $(".tabs li").scaleText is not a function. on this web site (https://www.topmarks.co.uk/maths-games/hit-the-button --> click "Play Game") with the WKWebView in my app. The page works fine on Safari, chrome and even SFSafariViewController. Could anyone please help me on that? Thank you.
0
0
60
2d
Using SF Pro for a shop website.
Hello! I am looking to use SF Pro as the main font of my website. This website is used as a place of purchase for some of my products, none of which will actually be using this font. The websites logo will also not be using this font, however I am worried that may be legally unviable. Please let me know if this is an option. I'm not looking to get direct financial gain by using your fonts, just would like to use it for the website. Thank you for your help.
0
0
56
2d
Apache on macOS 15 Sequoia
I have found that using the both the built in Apache webserver and the Homebrew variant does not work with the ssl related modules enabled, I have not narrowed down which module specifically crashes httpd, but I believe I have narrowed it down to be one of the ones that are required to use ssl. It exits with zsh: abort sudo httpd -k start while printing dyld[31928]: Assertion failed: (this->magic == kMagic), function isDelayInit, file Loader.cpp, line 464. to the error_log. I can provide more details, right now I feel like I'm forgetting to add something but I can't think of what it is.
1
4
133
2d
Cookies set by AJAX responses not accessible by JS when using WKWebView
Hi, we have really weird issue with one of our website embedded into iOS app using WKWebView. The website has CSRF mechanism implemented and is using some AJAX calls when user interact with it and in response some cookies are returned. Then the JS code wants to access these cookies to set proper value for next request header. Unfortunately when using document.cookie JS command these cookies are not there. However they are sent within another requests and I can see them from Safari Developer Inspector connected to my device or iOS Simulator. Another interesting thing is that the same website and solution works fine on Safari browser and with SFSafariViewController displayed inside our app. We've tried using various things for WKWebView configuration like nonPersistent data store, but without success. Does anyone have any idea how to deal with such issue and why it doesn't work with WKWebView?
0
2
90
3d
Student in need of help
So the css in this post is broken only on iphones if we view it on an android phone then there is no issues, and I can't figure out why? the scroll background is looking wired, but it's defined by: width: 60px; height: 60px;... Anyhow i'm just wondering why the css is not working as it should? Please help me 🙏
0
0
68
3d
Content blocker using Safari web extensions.
We are trying to implement ad blockers using the Safari web extension, and we are implementing this using the declarativeNetRequest, with a manifest version 2. We have added a json file which contains a rule set for over 22000 URLs, does content blocker have a limit to the number of rules we set in json? Although it does work fine, sometimes we see the behaviour different on simulators and on clearing the cache it works fine is this expected?
3
0
81
3d
Crash WKWebView startURLSchemeTask
When I use - webView: startURLSchemeTask: , I had some crash with iOS 14(14.1, 14.2, 14.3, 14.4). There is the code: - (void)webView:(WKWebView *)webView startURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask API_AVAILABLE(ios(11.0)){ /// iOS 13可能有崩溃 NSString *version = [[UIDevice currentDevice] systemVersion]; if ([version containsString:@"13."]) { SEL sel = sel_registerName("_setLoadResourcesSerially:"); id webViewClass = NSClassFromString(@"WebView"); if ([webViewClass respondsToSelector:sel]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" [webViewClass performSelector:sel withObject:@(FALSE)]; #pragma clang diagnostic pop } }//fi self.holdUrlSchemeTasks[urlSchemeTask.description] = @(TRUE); SCNADHtmlPreloadContext *context = [[SCNADHtmlPreloadContext alloc] init]; context.requestURL = [urlSchemeTask.request.URL.absoluteString copy]; // line 50 context.request = [urlSchemeTask.request copy]; // todo with context ...... } - (void)webView:(WKWebView *)webView stopURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask API_AVAILABLE(ios(11.0)){ dispatch_async(dispatch_get_main_queue(), ^{ self.holdUrlSchemeTasks[urlSchemeTask.description] = @(FALSE); }); } There is the crash info: #0 Thread SIGSEGV SEGV_ACCERR WebCore void ***::__visitor_table<***::Visitor<WebCore::FormData::resolveBlobReferences(WebCore::BlobRegistryImpl*)::$_8, WebCore::FormData::resolveBlobReferences(WebCore::BlobRegistryImpl*)::$_9, WebCore::FormData::resolveBlobReferences(WebCore::BlobRegistryImpl*)::$_10>, ***::Vector<char, 0ul, ***::CrashOnOverflow, 16ul, ***::FastMalloc>, WebCore::FormDataElement::EncodedFileData, WebCore::FormDataElement::EncodedBlobData>::__trampoline_func<WebCore::FormDataElement::EncodedBlobData>(***::Visitor<WebCore::FormData::resolveBlobReferences(WebCore::BlobRegistryImpl*)::$_8, WebCore::FormData::resolveBlobReferences(WebCore::BlobRegistryImpl*)::$_9, WebCore::FormData::resolveBlobReferences(WebCore::BlobRegistryImpl*)::$_10>&, ***::Variant<***::Vector<char, 0ul, ***::CrashOnOverflow, 16ul, ***::FastMalloc>, WebCore::FormDataElement::EncodedFileData, WebCore::FormDataElement::EncodedBlobData>&) + 68 WebKit::WebURLSchemeTask::nsRequest() const + 68 -[SNADURLSchemeHandler webView:startURLSchemeTask:] (SNADURLSchemeHandler.m:50) Who knows the reason, please help me, thanks!
0
0
71
3d
How to change geolocation settings on WKWebView
We're developing an application using location feature in WKWebView. When accessing a URL that uses location information from WebView, a dialog box saying " Would Like To Use Your Current Location - Don't Allow or OK". If "Dont allow" is selected multiple times, the dialog will disappear and the location setting for that URL will be fixed as "Don't Allow". In Safari, I can change that location settings for each URL, But Application's WebView does not have such settings UI. How do I clear or change the setting so that location information is no longer available? It seems that reinstalling the application will clear the WebView location settings.
0
0
82
3d
UIDevice: Main actor-isolated class property 'current' can not be referenced from a non-isolated context
I have a Safari Web Extension for visionOS that reads from UIDevice.current.systemVersion in order to provide the OS version number back to the JavaScript context utilizing beginRequest(with:). When switching my project to use Swift 6, I received this obscure error: Main actor-isolated class property 'current' can not be referenced from a non-isolated context Class property declared here (UIKit.UIDevice) Add '@MainActor' to make instance method 'beginRequest(with:)' part of global actor 'MainActor' Adding @MainActor causes another issue (Main actor-isolated instance method 'beginRequest(with:)' cannot be used to satisfy nonisolated protocol requirement) which suggests adding @preconcurrency to NSExtensionRequestHandling which then breaks at Non-sendable type 'NSExtensionContext' in parameter of the protocol requirement satisfied by main actor-isolated instance method 'beginRequest(with:)' cannot cross actor boundary. What's the proper solution here? Here's a simplified snippet of my code: class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { func beginRequest(with context: NSExtensionContext) { // ... var systemVersionNumber = "" systemVersionNumber = UIDevice.current.systemVersion // ... } }
1
0
151
4d
WKWebKit crash - blank screen
We are using a WKWebKit based Cordova application and we are getting WKWebKit crash resulting in blank page. The same web app is working in browser and other platforms. Upon investigation we found the memory used in iOS app using safari debugger / profiler. The total memory used is 870.13 MB. Break up of that is Page: 549MB JavaScript: 321.13MB However, the max comparison for memory shown in safari is 1.37GB while the current usage is 870.13MB. Is there any internal memory calculation for crash cutoff? In this case the current memory is around 62% of the max comparison. Hence, we need to know whether this is the expected behaviour from iOS platform. JetsamEvent-2024-05-23-102822.ips
0
0
141
6d
Enabling Picture-in-Picture (PiP) in WKWebView
I'm working on a web browser App that's distributed via the App Store. This app renders web pages using WKWebView. Our users are requesting a way for us to allow them to play videos in Picture in Picture. After some investigation, we noticed that in order to allow PiP videos in our browser in the sandboxed environment, we need to add the com.apple.PIPAgent entitlement under the com.apple.security.temporary-exception.mach-lookup.global-name option. We tried to submit our app with this entitlement, but unfortunately, we were rejected: Guideline 2.4.50) - Performance We've determined that one or more temporary entitlement exceptions requested for this app are not appropriate and will not be granted: com.apple.security.temporary-exception.mach-lookup.global-name com.apple.P|PAgent We would like to have access to this entitlement so we can offer PiP to our users. We already created a radar about this as well: FB13814428 Additionally, we have another radar (FB13557716) regarding allowing the usage of a private flag _allowsPictureInPictureMediaPlayback, which would also be required to enable us to use PiP. Is there any way in which we can currently enable PiP? Would opening a TSI help here?
1
9
303
1w
PaymentRequest TypeError
Details at Stack Overflow We're trying to enable Apple Pay on the Web for a web application of ours, but getting this error when trying to construct the PaymentRequest object: TypeError: Type error: PaymentRequest@[native code] startApplePay@https:-myurl-:319:47 onclick@https://-myurl-:606:14:undefined
0
0
216
1w
iOS 17.5.1 safari extension - background scripts not working properly
We had developed an iOS Safari web extension (which uses non-persistent background scripts) that functioned properly until iOS 17.3. However, I've encountered inconsistent behavior on iOS 17.4.1, 17.5, and 17.5.1. Upon further debugging, I noticed that the background scripts often become idle and are unloaded frequently. They are not loaded again even for the registered webNavigation events and only trigger when interacting with the extension popup menu. This is also mentioned here. I had tried this in both manifest versions 2 & 3. I had tried using service_worker for background scripts. But, none of it seems to resolve this issue. Could you please clarify if this is a bug or an intended behavior? Our extension relies on webNavigation events without users having to interact with the popup menu often.
0
3
224
1w
JavaScript Not Executing in WebView When Modally Presenting UIViewController on iOS 17.5.1
Issue Summary: I have encountered an issue where JavaScript does not execute in a WebView when another UIViewController is presented modally with modalPresentationStyle.fullScreen. This problem only occurs on physical devices running iOS 17.5.1. The issue is not present on iOS 17.5 simulators or devices running iOS 17.4.1 or earlier. Reproduction Steps: Create a ViewController with a WebView. Load a web page (e.g., https://apple.com) in the WebView. Present another ViewController modally with modalPresentationStyle.fullScreen. Verify that JavaScript execution in the initial WebView stops working. Test Code: import UIKit import WebKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let configuration = WKWebViewConfiguration() let webView = WKWebView(frame: view.frame, configuration: configuration) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let navigationController = UINavigationController(rootViewController: TargetViewController()) navigationController.modalPresentationStyle = .fullScreen present(navigationController, animated: true) } } class TargetViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let webView = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration()) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } } Observations: The JavaScript within the WebView stops executing only on physical devices running iOS 17.5.1. This issue does not occur on the iOS 17.5 simulator. Devices running iOS 17.4.1 or earlier do not experience this issue. Request for Assistance: Could you please provide any insights or potential workarounds for this issue? Additionally, if this is a known bug, any information on upcoming fixes would be highly appreciated. Thank you.
1
0
223
1w
SFSafariViewControllerDelegate not being called for redirects
This method does not seem to work consistently: SFSafariViewControllerDelegate.safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo URL: URL) It was working 100% of the time until this week for me, now it has about a 1-5% success rate for detecting redirects. The docs are not clear: @discussion This method may be called even after -safariViewController:didCompleteInitialLoad: if the web page performs additional redirects without user interaction. Code snippet from calling UIViewController that conforms to SFSafariViewControllerDelegate: let config = SafariViewController.Configuration() config.entersReaderIfAvailable = false let vc = SFSafariViewController(url: url, configuration: config) vc.delegate = self self.safariViewController = vc print(self.safariViewController?.delegate) self.present(vc, animated: true) Did something change? How can I make this consistent again?
1
0
193
1w
SFSafariViewControllerDelegate method for initialLoadDidRedirectTo not being triggered for subsequent reloads as specified in the docs
For some reason, not all of the time but most of the time, the SFSafariViewControllerDelegate method for initialLoadDidRedirectTo is not being triggered for subsequent reloads as specified in the docs. @discussion This method may be called even after -safariViewController:didCompleteInitialLoad: if the web page performs additional redirects without user interaction. I am allowing a user to log in with an OAuth 2.0 Provider on the Safari browser and expecting to detect the redirect to continue the flow from the app once their credentials have securely been consumed by the IdP in Safari. It was working consistently. It went from a 100% success rate up until this week to maybe 1/20 successful redirects. Code snippet: let config = SafariViewController.Configuration() config.entersReaderIfAvailable = false let vc = SFSafariViewController(url: url, configuration: config) vc.delegate = self self.safariViewController = vc print(self.safariViewController?.delegate) self.present(vc, animated: true) Why is it not always detecting the redirects?
1
0
225
1w
iOS 17.5.1 not updating permisions.
In this version of iOS our web extension is not allowed to run after allowing it run on all sites via clicking the aA icon in safari. Quitting safari makes it work so it is like the permisions are set but the extension code is never injected into the browser, this behaviour has been replicated with multiple different extension form different vendors.
0
0
162
1w