我在app上有一个应用程序,它可以使用CloudKit,而远程通知在那里工作得很好。如果用户修改了一个记录,它会在他/她的其他设备上触发一个推送通知,然后调用AppDelegate的didReceiveRemoteNotification。
在dev环境中,我添加了一些新的实体,但是在我的测试中,推送通知不再被接收。基本上,didReceiveRemoteNotification根本没有被调用。
一些重要的注意事项:
alertBody = @"“(不是零字符串)我使用Xcode深入研究了设备的控制台日志,发现控制台确实输出了一些提示设备正在接收推送通知的内容,但由于某种原因,它没有被传递到应用程序中:
default 18:02:47.127117 -0800 SpringBoard Received incoming message on topic com.apple.icloud-container.com.ztest.myapp at priority 10
default 18:02:47.133708 -0800 SpringBoard [com.ztest.myapp] Received remote notification request 0E01-5E4D [ waking: 0, hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 pushType: Alert]
default 18:02:47.133780 -0800 SpringBoard [com.ztest.myapp] Process delivery of push notification 0E01-5E4D
error 18:02:47.133851 -0800 SpringBoard [com.ztest.myapp] NOT requesting DUET deliver content-available, non-notifiying push notification 0E01-5E4D [pushType: Alert willNotifyUser: 0]
error 18:02:47.133997 -0800 SpringBoard [com.ztest.myapp] NOT delivering non-notifying push notification 0E01-5E4D [pushType: Alert willNotifyUser: 0]
default 18:02:47.134053 -0800 SpringBoard Getting effectiveSectionInfo for section identifier: com.ztest.myapp
default 18:02:47.134099 -0800 SpringBoard [com.ztest.myapp] Getting effective section info
default 18:02:47.135743 -0800 SpringBoard [com.ztest.myapp] Got effective section info [ hasResult: 1 ]我不太确定,但这里显示“不传递非通知推送通知”的“错误”的一行似乎可以解释这个问题。但我不知道是什么导致了这一切。难道仅仅是开发环境变得稀奇古怪吗?我已经在多个iOS设备上尝试过了,所以这不仅仅是一个设备的问题。
有谁能提出为什么在应用程序中没有收到推送通知的原因,或者提出一些方法来测试这个结果并缩小发生的范围呢?
谢谢。
更新
结果,我不太确定沉默的推送通知是否在生产版本上有效!看起来,推送是由CloudKit服务器发送的(查看CK仪表板),但没有在设备上接收。
发布于 2020-02-12 23:02:33
事实证明,这是一个iOS13问题,也没有在发行版上工作。显然,苹果改变了行为,所以当您设置CKSubscription时,CKNotificationInfo的alertBody属性应该是nil,而不是空字符串,这是您之前需要做的工作。
https://stackoverflow.com/questions/60180150
复制相似问题