How to get the current active iCloud username on an iOS device to show it in my application?
Code from the comment below OP
NSURL ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
if (ubiq)
{
NSLog(@"iCloud access at %@", ubiq.user);
}
else
{
UIAlertView alert=[[UIAlertView alloc]initWithTitle:@"No iCloud access" message:@"Please set your iCloud account in Setting-iCloud" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
}
If you know how to display your iCloud username, please tell me. I was already looking for this, but I could not find the answer to my question.
source
share