问题描述
我使用下面的CKNotification信息,这似乎工作正常:
I am using the following CKNotification Info and this seems to work fine:
CKNotificationInfo * note = [[CKNotificationInfo alloc] init];
note.alertBody = @Something Happened;
note.shouldBadge = NO;
note.shouldSendContentAvailable = NO;
当iOS设备上发生变化时,我的Mac应用会收到基于订阅此通知。但是, didReceiveRemoteNotification
从未被调用,因此我无法处理事件。我需要能够刷新和获取新的更改。
When something changes on an iOS device, my Mac app receives a Push notification based on a subscription with this notification. However, didReceiveRemoteNotification
is never called so I can't process the event. I need to be able to refresh and fetch new changes. How do I do that?
推荐答案
好吧,我终于搞清楚了。如果您使用CKNotificationInfo作为快讯,除非您设定 CKNotificationInfo.soundName
didReceiveRemoteNotification >到空字符串!这看起来像一个bug只在OS X(10.10& 10.11到目前为止),但可以通过这个简单的更改。
Okay I've finally figured it out. If you use a CKNotificationInfo for your alerts, didReceiveRemoteNotification
will NOT be called on the Mac until and unless you set CKNotificationInfo.soundName
to an empty string! This looks like a bug only in OS X (10.10 & 10.11 so far) but can be worked around by this simple change.
这篇关于CloudKit didReceiveRemoteNotification不在Mac上调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!