更新时间:2021-12-25 23:04:08
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"方法,它会返回NO",即使安装了已注册处理此方案的应用程序.将出现此应用不允许查询方案 xxx"系统日志条目.
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"方法,它将静默失败.将出现此应用不允许查询方案 xxx"系统日志条目.
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.