I'm currently observing .NSUbiquityIdentityDidChange which I read should be triggered whenever an iCloud related change occurs but it's not being triggered if I disable iCloud for my app in Settings > Apple ID > iCloud > Apps using iCloud
            Asked
            
        
        
            Active
            
        
            Viewed 38 times
        
    -1
            
            
         
    
    
        Peter Warbo
        
- 11,136
- 14
- 98
- 193
- 
                    You could do that using CloudKit API, by checking the account status with one of the options in this other question: https://stackoverflow.com/questions/32335942/check-if-user-is-logged-into-icloud-swift-ios?rq=2 – vicegax Jul 23 '23 at 11:51
- 
                    I need to observe it when it changes. – Peter Warbo Jul 23 '23 at 12:09
- 
                    Try using `CKAccountChanged` Notification https://developer.apple.com/documentation/foundation/nsnotification/name/1399172-ckaccountchanged – vicegax Jul 23 '23 at 12:38
- 
                    Thanks, that notification is indeed triggered. Add this an answer and I'll accept it. – Peter Warbo Jul 23 '23 at 17:17
1 Answers
1
            You can accomplish this with CloudKid.
By registering to CKAccountChanged Notification.
Example
import CloudKit
...
NotificationCenter
    .default
    .addObserver(forName: .CKAccountChanged, 
                  object: nil, 
                   queue: nil) { notification in
                   }
 
    
    
        vicegax
        
- 4,709
- 28
- 37
