iOS 9没有使用URL SCHEME打开Instagram应用程序 [英] iOS 9 not opening Instagram app with URL SCHEME

查看:255
本文介绍了iOS 9没有使用URL SCHEME打开Instagram应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下网址在iOS 8.3及更低版本上打开,但不起作用,iOS 9

The following URL opens on iOS 8.3 and lower, but it does not work and iOS 9

let instagramURL = NSURL(string: "instagram://app")

为什么网址不会打开?

推荐答案

iOS 9对URL方案的处理做了一些小改动。您必须使用 Info.plist 中的 LSApplicationQueriesSchemes 键将您的应用调用的网址列入白名单。

iOS 9 has made a small change to the handling of URL scheme. You must whitelist the url's that your app will call out to using the LSApplicationQueriesSchemes key in your Info.plist.

请看这里的帖子: http://awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes

主要结论是:


如果您在不在白名单中的URL上调用canOpenURL方法,它将返回否,即使安装了已注册处理此方案的应用程序。将出现此应用程序不允许查询方案xxxsyslog条目。

If you call the "canOpenURL" method on a URL that is not in your whitelist, it will return "NO", even if there is an app installed that has registered to handle this scheme. A "This app is not allowed to query for scheme xxx" syslog entry will appear.

如果您在白名单中没有的URL上调用openURL方法,它会默默地失败。将出现此应用程序不允许查询方案xxxsyslog条目。

If you call the "openURL" method on a URL that is not in your whitelist, it will fail silently. A "This app is not allowed to query for scheme xxx" syslog entry will appear.

作者还推测这是一个错误操作系统和Apple将在后续版本中修复此问题。

The author also speculates that this is a bug with the OS and Apple will fix this in a subsequent release.

这篇关于iOS 9没有使用URL SCHEME打开Instagram应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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