gpt4 book ai didi

ios - didReceiveRemoteNotification :fetchCompletionHandler: but the completion handler was never called

转载 作者:IT王子 更新时间:2023-10-29 05:49:24 26 4
gpt4 key购买 nike

我一直在尝试实现获取完成 block ,但没有成功。每当我发送 APN 时,xcode 仍然提示它没有实现。这是我的代码

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {

println("2. User Data", userInfo)

completionHandler(UIBackgroundFetchResult.NewData)

}

我在 xcode 控制台中收到的警告是这样的

Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.

不确定我在这里实现的语法是否正确

最佳答案

删除 println 或将其更改为 NSLog,然后重试。问题很可能是因为这个方法是在后台而不是在主线程上出现的。 println 比 NSLog 简单得多,NSLog 是线程安全的,并且经过多年强化。

关于ios - didReceiveRemoteNotification :fetchCompletionHandler: but the completion handler was never called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28753884/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com