【问题标题】:Manual urban airship call to UAAppIntegration.userNotificationCenter need to call completionHandler?手动城市飞艇调用UAAppIntegration.userNotificationCenter需要调用completionHandler?
【发布时间】:2017-05-29 16:10:15
【问题描述】:

我们将 appdelegate 完成处理程序传递给 urbanairship,并在最后调用 appdelegate 完成处理程序

    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Swift.Void) {
    UAAppIntegration.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
    completionHandler()
}

或者我们在 urbanairship 完成中调用 appdelegate 完成处理程序

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Swift.Void) {
    UAAppIntegration.userNotificationCenter(center, didReceive: response) {
        completionHandler()
    }
}

或者我们只是将完成传递给urbanairship(那么如果我们有代码,我们需要在调用urbanairship之前调用它?)

    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Swift.Void) {
    UAAppIntegration.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
}

【问题讨论】:

    标签: ios swift urbanairship.com


    【解决方案1】:

    您想要选择第二个或第三个选项。完成处理程序应该只被调用一次。查看docs 了解您必须致电 UA 的所有地方以及一个示例。

    【讨论】:

    • 我想,但由于它是一个黑匣子,他们没有说如果他们确实处理了某些事情,或者如果我们处理了某些事情,我们不应该将它转发给城市,他们是否会调用完成处理程序?跨度>
    • SDK 是开源的,所以它并不是一个真正的黑匣子。回调将始终由 UA 调用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多