简体   繁体   English

沉默“-canOpenURL:URL失败:”

[英]Silence “-canOpenURL: failed for URL:”

I have added my URL schemes to Info.plist, as required by iOS 9. However, calls result in: 我已根据iOS 9的要求将我的URL方案添加到Info.plist中。但是,调用会导致:

-canOpenURL: failed for URL: "scheme://" - error: "(null)"

being logged to the console. 被记录到控制台。 The calls are succeeding and returning the correct value, but these log messages are annoying. 调用成功并返回正确的值,但这些日志消息很烦人。 How can I disable them? 我怎样才能禁用它们?

Try just using openURL: to check if it can open, since it returns a Bool, then call openURL: again: 尝试使用openURL:检查它是否可以打开,因为它返回一个Bool,然后再次调用openURL:

if let url = NSURL(string: keyword) {
    if UIApplication.sharedApplication().openURL(url) {
        UIApplication.sharedApplication().openURL(url)
    }
}

Looks weird to see the same statement repeated twice, but at least it doesn't spit out a failure message like canOpenURL: does. 看起来很奇怪看到相同的语句重复了两次,但至少它没有吐出像canOpenURL这样的失败消息。 If anyone knows how to make it look less weird, please do tell. 如果有人知道如何使它看起来不那么奇怪,请告诉我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 -canOpenURL:URL失败:“ spotify:”-错误:“(null)” - -canOpenURL: failed for URL: “spotify:” - error: “(null)” swift3 - canOpenURL:URL 电话失败 - swift3 - canOpenURL: failed for URL tel -canOpenURL:URL失败:“fbauth2:/” - 错误:“(null)” - -canOpenURL: failed for URL: “fbauth2:/” - error: “(null)” -canOpenURL:URL失败:“fbauth2:/”(OSStatus错误-10814。)“ - -canOpenURL: failed for URL: “fbauth2:/” (OSStatus error -10814.)" -canOpenURL:由于 facebook 和其他社交网络的 URL 错误而失败 - -canOpenURL: failed for URL error for facebook and other social networks Pinterest身份验证失败:-canOpenURL:URL失败:“pinterestsdk.v1:// oauth - Pinterest authentication fails: -canOpenURL: failed for URL: "pinterestsdk.v1://oauth -canOpenURL:URL失败:“ fbauth2:/”-iOS 9错误:“(空)”(快速) - -canOpenURL: failed for URL: “fbauth2:/” - error: “(null)” for ios 9 (swift) -canOpenURL:URL失败:“ testapp23://”-错误:“(null)” - -canOpenURL: failed for URL: “testapp23://” - error: “(null)” facebook登录问题 - canOpenURL:网址失败:“fbauth2:///” - 错误:“(null)” - facebook login issue - canOpenURL: failed for URL: “fbauth2:///” - error: “(null)” Facebook 登录套件,带有 iOS 13“canOpenURL:URL 失败:“fbauth2:///” - Facebook Login kit with iOS 13 "canOpenURL: failed for URL: “fbauth2:///”"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM