我试图通过 UIButton 操作从我的 iOS 应用程序打开 Instagram 应用程序,但它不起作用。它什么也没显示。
这是我在 Swift 3 中的代码:
@IBAction func Instagram(_ sender: AnyObject) {
let instagramURL = URL(string: "instagram://app")!
if UIApplication.shared.canOpenURL(instagramURL) {
UIApplication.shared.openURL(instagramURL)
}
Run Code Online (Sandbox Code Playgroud)