Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if iCloud account on a device changed?

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?

like image 541
erkanyildiz Avatar asked Feb 22 '13 10:02

erkanyildiz


People also ask

How can I tell if someone has logged into my Apple ID or iCloud?

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.

How do I know if someone is accessing my iCloud?

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.


1 Answers

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

like image 151
Ivan Lisovyi Avatar answered Oct 05 '22 20:10

Ivan Lisovyi