我无法让Deep链接在快速的iOS模拟器中响应

时间:2016-10-03 21:08:57

标签: ios swift swift3 deep-linking

所以我试图让FB和Twitter在桌面上响应tappin:

我设置了plist:

enter image description here

然后我创建了这个函数:

 func schemeAvailable(scheme: String) -> Bool {
        if let url = URL(string: scheme) {
            return UIApplication.shared.canOpenURL(url)
        }
        return false
    }

然后我尝试使用它:

  print(UIApplication.shared.canOpenURL(URL(string: "fb:")!))

    if(schemeAvailable(scheme: "fb://")){
        print("facebook agailable")
    }
    if(schemeAvailable(scheme: "twitter://")){
        print("twitter agailable")
    }

并得到回复:

2016-10-03 17:04:09.096 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "fb:" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
false
2016-10-03 17:04:09.097 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "fb://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2016-10-03 17:04:09.098 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "twitter://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

我已尝试使用和不使用字符串中的//但无效...每次都会收到相同的错误。

由于

0 个答案:

没有答案