在我的应用中,我具有ovpn配置文件(例如,在Document目录中)。我想将此文件发送(共享)到官方客户端openVPN。
我已经实现了:
let app = UIApplication.shared
var installed: Bool? = nil
if let url = URL(string: "openvpn://") {
installed = app.canOpenURL(url)
}
guard installed ?? false, let url = URL(string: "openvpn://") else {
if let url = URL(string: "https://itunes.apple.com/app/id590379981?mt=8") {
app.open(url)
}
return
}
app.open(url)
这很有效,但是我不知道如何改善url方案,因此,我也不知道如何将文件发送到“导入配置文件”屏幕。您能否分享您的经验?
是,我知道UIActivityViewController
let activityViewController = UIActivityViewController(activityItems: [ovpnUrlPath], applicationActivities: nil)
self.present(activityViewController, animated: true, completion: nil)
但是还有其他用户的操作,但是又能很好地起作用:预期在“导入配置文件”屏幕上打开了配置文件:
问题是:如何通过openVPN的url方案共享我的ovpn?
我已经收到来自openVPN官方帐户的评论:
unfortunately, OpenVPN Connect client application doesn't have functionality for sharing connection profiles.
所以,现在不可能了。