canOpenURL无法在ios 10中运行 [英] canOpenURL not working in ios 10

查看:821
本文介绍了canOpenURL无法在ios 10中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上面的代码总是返回false

The above code is always returning false

if {(UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!))}

我想这是在iOS10中发现的问题。
我试图打开谷歌地图应用程序,如果在一个安装或尝试打开苹果地图,所以想使用canOpenURL。有没有其他选择

I guess this a problem found in iOS10. I am trying to open google maps app if there in one installed or try to open apple maps so wanted to use canOpenURL . are there any alternatives

推荐答案

将此添加到您的Info.plist,然后尝试调用canOpenURL。

Add this to your Info.plist and then try calling canOpenURL.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>comgooglemaps</string>
</array>

这篇关于canOpenURL无法在ios 10中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆