How to detect if iCloud account being used on a device changed?
A user signs out from Settings > iCloud and another user signs in his/her account.
How to detect this change when the app is opened?
Go to appleid.apple.com and sign in to your Apple ID. Look at the Devices section. Click on Details. You will see all the devices signed in with your Apple ID.
Sign in to the Apple ID website (https://appleid.apple.com) and review all the personal and security information in your account to see if there is any information that someone else has added.
Just add an observer for the notification with name NSUbiquityIdentityDidChangeNotification
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector (iCloudAccountAvailabilityChanged:)
name: NSUbiquityIdentityDidChangeNotification
object: nil];
If a user signs out of iCloud, such as by turning off Documents & Data in Settings, the ubiquityIdentityToken method returns nil. To enable your app to detect when a user signs out and signs back in, register for changes in iCloud account availability. - Apple Documentation
http://developer.apple.com/library/mac/#documentation/General/Conceptual/iCloudDesignGuide/Chapters/iCloudFundametals.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With