How to receive cloudkit notifications about changes made on record shared with me?

痴心易碎 提交于 2019-12-03 03:23:23
Thunk

Here's my checklist for debugging subscription notifications not appearing as expected. Sounds like you may have ruled some of these out already.

  1. Make sure the app is registered for notifications
  2. Make sure notifications are enabled on the device for this app
  3. Make sure all devices are using the same container
  4. On the next app startup, read all subscriptions using fetchAllSubscriptionsWithCompletionHandler and NSLog each sub's details (especially: subscriptionID, trigger options, record type and the predicate). Verify that the expected subs exist. Verify that each sub's predicate matches expectations (in this case, compare the predicates you find on both devices).

I wasted a bunch of time debugging "missing" notifications when:

  1. My locally-built version was using the TEST environment and the TestFlight users were accessing the PROD environment. Debugging step 2 found this.
  2. When inadvertently re-using a subscription ID, thus each new sub overwrote the prior one. Debugging step 4 eventually revealed the problem

So far, these four debugging steps have helped me understand all of my "missing notification" problems. Once I understood why the notifs didn't appear, that narrowed down which block of code was responsible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!