【发布时间】:2017-03-09 10:38:20
【问题描述】:
我在我的 HTTPS 根目录 (kumpul.co.id/apple-app-site-association) 中提供了 apple-app-site-association,结果从 https://branch.io/resources/aasa-validator/#resultsbox 传递过来
我已在我的权利中配置它:applinks:kumpul.co.id
我已经把这个函数放在我的 Appdelegate.swift 中:
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
NSLog("Check Universal Link")
// 1
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL,
let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else {
return false
}
print("url: \(url)")
print("component: \(components)")
// 2
if let match = MatchHandler.sharedInstance.items.filter({ $0.path == components.path}).first {
self.presentMatch(match)
return true
}
//3
let webpageUrl = URL(string: "http://www.kumpul.co.id")!
application.openURL(webpageUrl)
return false
}
对于路径,我设置了 "paths": [ "/match/*"] 因为链接将是 kumpul.co.id/match/play_2.html 例如
但是当我点击我在 WhatsApp 或 Line 消息上的链接时,这个函数根本不会被调用,当我点击链接时我看不到日志。我在这里做错了什么?
【问题讨论】:
标签: iphone swift3 xcode8 ios10 ios-universal-links