6

我正在尝试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>!

它确实在其他操作系统中工作了一段时间,并完全停止直到下一次启动。

4

1 回答 1

0

没有什么要解决的。这是预期的行为。自 WWDC13 以来,一直明确表示后台活动将仅限于实际使用的应用程序。可以通过 11 之前的静默推送来绕过此限制,但与往常一样,它成为一种常见的滥用行为。实际上很惊讶 dasd 在以前的版本中没有更具侵略性。

于 2018-04-12T13:32:30.690 回答