CNContactStoreDidChangeNotification is fired multiple times

后端 未结 3 756
感情败类
感情败类 2020-12-30 22:50

I am able to observe the CNContactStoreDidChangeNotification when the contact database is changed while the app is in background state. I am pretty sure that on

3条回答
  •  滥情空心
    2020-12-30 23:43

    You can start a one time execution timer or a dispatch after few seconds and cancel it in case there's a new contacts update within those seconds, thus ensuring that only the timer or dispatch_after triggered by the last update will actually execute (taking into account that all update calls come one after the other within under a sec. difference, as far as I tested)

    And btw, I could reproduce the issue only when making change to contacts on the same device with my app. If I change the contacts on another device linked to the same apple account, there was only one update.

提交回复
热议问题