隐藏 sfsafariviewcontroller 中的控件

Hide controls in sfsafariviewcontroller

let sfViewController  = SFSafariViewController(url: url)
sfViewController.delegate = self

self.ViewC!.present(sfViewController, animated: false, completion: nil)

我正在我的应用程序中打开 SFSafariViewController。但是出于安全问题,我不想要这个视图给出的控件。此视图提供诸如完成、刷新、共享、在 Safari 中打开等操作。

出于我的目的,我只希望操作完成。其他操作不应该对用户可见。我支持 ios 10.0 + 。 至少那个工具栏不应该在那里。 可以这样做吗?

不,您不能自定义 SFSafariViewController。

Apple 说:

Important

In accordance with App Store Review Guidelines, this view controller must be used to visibly present information to users; the controller may not be hidden or obscured by other views or layers. Additionally, an app may not use SFSafariViewController to track users without their knowledge and consent.

最后,事实上,您可以使用 WKWebView 来进一步自定义您的屏幕。

If your app lets users view websites from anywhere on the Internet, use the SFSafariViewController class. If your app customizes, interacts with, or controls the display of web content, use the WKWebView class.

阅读文档:https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller