Skip to content

Instantly share code, notes, and snippets.

@spotlessicode
Created January 3, 2017 21:29
Show Gist options
  • Save spotlessicode/c5c6e59e915519587916ebb7e8e8f709 to your computer and use it in GitHub Desktop.
Save spotlessicode/c5c6e59e915519587916ebb7e8e8f709 to your computer and use it in GitHub Desktop.
#pragma mark - ICLOUD
- (BOOL)iCloudAccountIsSignedIn {
if (debug==1) {
NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));
}
id token = [[NSFileManager defaultManager] ubiquityIdentityToken];
if (token) {
NSLog(@"** iCloud is SIGNED IN with token '%@' **", token);
return YES;
}
return NO;
}
- (BOOL)iCloudEnabledByUser {
if (debug==1) {
NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));
}
[[NSUserDefaults standardUserDefaults] synchronize];
if ([[[NSUserDefaults standardUserDefaults]objectForKey:@"iCloudEnabled"] boolValue]) {
NSLog(@"** iCloud is ENABLED in Settings **");
return YES;
}
NSLog(@"** iCloud is DISABLED in Settings **");
return NO;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment