我正在寻找与以下代码,我们能够打开脸书或推特iOS应用程序,但有没有办法做到这一点的帕特雷恩应用程序?
let appURL = NSURL(string: "fb://profile/\(facebook)")!
let webURL = NSURL(string: "https://www.facebook.com/\(facebook)")!
let application = UIApplication.shared
if application.canOpenURL(appURL as URL) {
application.open(appURL as URL)
} else {
application.open(webURL as URL)
}我还在Info.plist上包含了以下几行:
<array>
<string>instagram</string>
<string>fb</string>
</array>您能告诉我如何在info.plist上添加Patreon应用程序吗
发布于 2020-06-11 21:42:21
我写这篇评论是为了让你知道我昨天发现了解决方案:
let webURL = NSURL(string: "https://www.patreon.com/\(patreonUserName)")!
let application = UIApplication.shared
application.open(webURL as URL)诚挚的问候。
发布于 2020-05-18 14:44:53
尝试使用以下代码
在Plist文件中,添加以下内容-
<string>com.patreon.iphone</string>现在从应用程序调用,就像FB一样调用。我已经使用以下代码在更新后的Xcode (11.4和swift 5.x)中进行了测试,该代码运行良好-
func open(scheme: String) {
if let url = URL(string: scheme) {
UIApplication.shared.open(url, options: [:], completionHandler: {
(success) in
print("Open \(scheme): \(success)")
})
}
}呼叫:
self.open(scheme: "com.patreon.iphone://")
注意:并不是所有的应用都有Url模式。如果您需要了解网址模式,请下载IPA并使用此Apple Configurator 2查看第三方应用程序的plist文件。这是一个有用的link。
https://stackoverflow.com/questions/61847330
复制相似问题