[英]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.