Post

Replies

Boosts

Views

Activity

How do I properly observe iCloud changes?
Can anyone tell me best/proper practices for observing iCloud changes? My application is shutting down every time I change the setting in iCloud for my app. By that I mean pressing the toggle switch just for my app. From what I have gathered, that is expected iOS behavior, however, according to this document from Apple , I can/should observe the NSUbiquityIdentityDidChange notification for any iCloud changes which I am (wrongfully?) assuming includes toggling that button. I have looked at this question in SO that suggests observing CKAccountChanged instead. What I am trying to accomplish is whenever any changes are made to the iCloud settings, before my app shuts down, save user information taking the iCloud changes into consideration. Observing either of these notifications does not reliably call the Selector method I pass in the observer, more often than not, the app shuts down before the method is even called from what I can tell in the debugger. Is there something else I should be taking into consideration? I am putting all interactions with the NotificationCenter and CKContainer in the App Delegate. Any help or guidance with this would be very helpful. Thank you!
0
0
502
Oct ’21