这是当应用程序在后台运行时
当我一次发送一个推送通知时,它工作正常,应用程序处理通知并调用UAPushNotificationDelegate
completionHandler
。
当我一起发送两个推送通知时,就会出现问题(第二个在处理第一个推送通知之前立即发送)
didReceiveRemoteNotification
是从SDK调用的,completionHandler
是在SDK中处理第二个通知之前调用的,因此我实现了UAPushNotificationDelegate
方法receivedBackgroundNotification:(UANotificationContent *)notificationContent completionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
, 应用程序崩溃抱怨EXC_BREAKPOINT (code=1, subcode=0x103b496f0)
这意味着它正在尝试访问 SDK 已经发布的completionHandler
。
我该如何处理?
收到推送通知时立即返回completionHandler
receivedBackgroundNotification:(UANotificationContent *)notificationContent completionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
,之后执行任务,因为iOS唤醒应用程序30秒。
这对我有用,自从更改以来没有发生过这种崩溃。