无法在iOS 11.2.6中处理静默推送通知

时间:2018-04-12 07:32:04

标签: ios apple-push-notifications appdelegate silentpush

我正在尝试在我的应用中定期实施Silent Push Notification,即每天一次将数据上传到服务器。
但是在 iOS 11.2.6 它始终未能调用委托方法

-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))

completionHandler无声推送通知。

在设备日志中,我可以看到收到了静默推送通知,但DuetActivitySchedulerDaemon取消了应用程序启动(根据日志)。

你能帮我解决一下这个问题吗?以下是设备日志。

Apr 11 21:44:59 iPhone- SpringBoard(UserNotificationsServer)[2696] <Notice>: [com.***.***-myapp] Received remote notification request 91E8-DC24 [ hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 ]
Apr 11 21:44:59 iPhone- SpringBoard(UserNotificationsServer)[2696] <Notice>: [com.***.***-myapp] Deliver push notification request 91E8-DC24. 
Apr 11 21:44:59 iPhone- SpringBoard(UserNotificationsServer)[2696] <Notice>: [com.***.***-myapp] Passing content-available push to Duet. 
Apr 11 21:44:59 iPhone- SpringBoard(DuetActivityScheduler)[2696] <Notice>: SUBMITTING: <private>. 
Apr 11 21:44:59 iPhone- SpringBoard(UserNotificationsServer)[2696] <Error>: Ignoring notification with no alert, sound or badge (com.***.***-myapp): 91E8-DC24
Apr 11 21:44:59 iPhone- SpringBoard(UserNotificationsServer)[2696] <Notice>: [com.***.***-myapp] Not saving push notification 91E8-DC24 to store [ error=Error Domain=UNErrorDomain Code=1401 "Notification has no user-facing content" UserInfo={NSLocalizedDescription=Notification has no user-facing content} ]
Apr 11 21:44:59 iPhone- dasd(DuetActivitySchedulerDaemon)[163] <Notice>: Submitted Activity: com.apple.pushLaunch.com.***.***-myapp:88F855 <private>
Apr 11 21:44:59 iPhone- dasd(DuetActivitySchedulerDaemon)[163] <Notice>: Daemon Canceling Activities: {(
com.apple.pushLaunch.com.***.***-myapp:88F855 )}
Apr 11 21:44:59 iPhone- dasd(DuetActivitySchedulerDaemon)[163] <Notice>: CANCELED: com.apple.pushLaunch.com.***.***-myapp:88F855 <private>!

它在其他操作系统中运行一段时间,并在下次启动之前完全停止。

1 个答案:

答案 0 :(得分:0)

没有什么可以解决的。这是一种预期的行为。 自WWDC13以来,始终明确指出,后台活动将仅限于实际使用的应用程序。有可能通过前11的静音推动绕过这个限制,但一如既往地它成为一种常见的滥用。实际上,在以前的版本中,dasd并没有更具侵略性,这实在令我感到惊讶。