Deeplink 仅打开应用程序但不打印操作所需的组件 swift
Deeplink just opens application but does not print componet needed for action swift
我将 Universal Link 添加到我的项目中,并完成了将关联文件上传到我的服务器的整个过程。已测试,可用。现在我正在尝试打印一个特定的值,但是每当我单击该应用程序时,它只会打开应用程序。我尝试在控制台上打印一些值,但它们从未打印出来下面是我的代码
extension AppDelegate {
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL,
let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else {
return false
}
log("DEEP :LINK 1 \(components)", .fuck)
log("DEEP :LINK 2 \(components.url)", .fuck)
log("DEEP :LINK 3 \(Int(components.url?.lastPathComponent ?? "0"))", .fuck)
// presentDetailViewController(Int(components.url?.lastPathComponent ?? "0") ?? 0)
NotificationEvent.id.accept(Int(components.url?.lastPathComponent ?? "0") ?? 0)
NotificationEvent.isFromNotification.accept(true)
if let webpageUrl = URL(string: "https://example.com") {
log("DEEP :LINK 1 weby \(webpageUrl)", .fuck)
application.open(webpageUrl)
return false
}
return true
}
}
你试试用
print("something")
而不是
log("something")
?
我将 Universal Link 添加到我的项目中,并完成了将关联文件上传到我的服务器的整个过程。已测试,可用。现在我正在尝试打印一个特定的值,但是每当我单击该应用程序时,它只会打开应用程序。我尝试在控制台上打印一些值,但它们从未打印出来下面是我的代码
extension AppDelegate {
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL,
let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else {
return false
}
log("DEEP :LINK 1 \(components)", .fuck)
log("DEEP :LINK 2 \(components.url)", .fuck)
log("DEEP :LINK 3 \(Int(components.url?.lastPathComponent ?? "0"))", .fuck)
// presentDetailViewController(Int(components.url?.lastPathComponent ?? "0") ?? 0)
NotificationEvent.id.accept(Int(components.url?.lastPathComponent ?? "0") ?? 0)
NotificationEvent.isFromNotification.accept(true)
if let webpageUrl = URL(string: "https://example.com") {
log("DEEP :LINK 1 weby \(webpageUrl)", .fuck)
application.open(webpageUrl)
return false
}
return true
}
}
你试试用
print("something")
而不是
log("something")
?