ios - openURL 并在 IOS 9/10 中打开

标签 ios swift ios9 ios10 uiapplication

-UIApplication.shared.openURL(url)
-UIApplicartion.shared.open(url,options: [:],completionHandler: nil)

我可以在 iOS9 和 iOS10 中使用这两个选项吗?

iOS9 和/或 iOS10 是否支持 UIApplication.shared.openURL(url)

最佳答案

你可以试试这个

guard let url = URL(string: "http://www.google.com") else {
  return //be safe
}

if #available(iOS 10.0, *) {
    UIApplication.shared.open(url)
} else {
    UIApplication.shared.openURL(url)
}

关于ios - openURL 并在 IOS 9/10 中打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48393800/

相关文章:

来自其他用户的 iOS SoundCloud 流

ios - 更新/更改 Swift 中枚举的 rawValue

ios - 缩放 SpriteKit 游戏

ios - 使自定义 UITableView 单元格正确显示内容(非空白)

ios - Swift 2 上的同步 URL 请求

ios - 无法使用类型为 (Int64, String) 的参数列表调用 setValue

iOS - 基于日期范围的 UITableView 部分

ios - 在应用程序中将 google Plus 和 Google AppInvite 的 Pod 集成在一起

iOS9 通用链接不适用于 Safari,但适用于其他应用程序

ios - 在 iOS/Swift 中从 gs_instruments 播放单个 midi 音符