I need to display a website in SFSafariViewController
in an iPad app.
The website (an SAP Analytics Cloud Site) continuously asks the user for showing a Popup for authentication and although the toggles in the device's preferences are already set to allow pop-ups, this alert keeps showing up every time a popup is triggered. The "Allow" decision is not even persisted for the current session.
--> Is there a possibility to allow it automatically so that the user does not see this alert?
I'm not planning an AppStore release whatsoever so any hacky solutions are definitely welcome!
Unfortunately, WebKit did not work so far and I also know the dialogue is system-triggered and an Apple-side privacy requirement, but in my use case it must not be shown by all means.
I developed an app accessing an SAP Analytics Cloud site once and had the same problem. I couldn't solve it with SFSafariViewController
at first, so I decided to go with WKWebView
. Eventually, it worked for me this way:
NSCrossWebsiteTrackingUsageDescription
in the Info.plist and also add a Settings.bundle
file. (See Using NSCrossWebsiteTrackingUsageDescription to request user disable ITP for WKWebView). Doing so, the Authentication using Popups worked flawlessly.webView(webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView?
function from WKUIDelegate
to create a small „Popup Webview“. In your use case, you can set the frame to .zero to make it invisible. Just make sure you return a WKWebView
.webViewDidClose(_ webView: WKWebView)
from WKUIDelegate
to remove the popup from the superview once the Authentication completed.