Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve current iCloud account information in Xcode

Tags:

xcode

ios

icloud

How to get current active iCloud account username in iOS device to show it in my application?

Code from the comment below by OP

NSURL ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];

if (ubiq) 
{ 
    NSLog(@"iCloud access at %@", ubiq.user); // TODO: Load document... 
} 
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]; // [alert show]; NSLog(@"No iCloud access"); 
}

If you know how to to show iCloud account username please tell me. I have already searched for this, but I could not find any answer for my case.

like image 482
Faiz Avatar asked Jan 22 '14 04:01

Faiz


People also ask

How to retrieve deleted iCloud data?

Below is the step by step guide to help you in retrieving iCloud data by using restore and reset “Erase all content and settings”. Step 1: Open the “Settings” app on your iPhone. Step 4: Sign in with your Apple ID and then select the backup file to restore the data.

What can I do with my iCloud account?

Sign in to iCloud to access your photos, videos, documents, notes, contacts, and more. Use your Apple ID or create a new account to start using Apple services. iCloud

What can I do with Xcode cloud?

With Xcode Cloud, you can automatically and frequently: Build your project. Run tests and perform verifications. Distribute builds to testers and gather their feedback with TestFlight while protecting user privacy.

What is imyfone iCloud data recovery Mac version?

iMyFone iCloud Data Recovery or iMyFone iCloud Data Recovery Mac version is a smart data recovery tool through which your lost data or existing data on your iOS device can be easily recovered or extracted.


1 Answers

You can't do it. The details of the iCloud account are not available to third party apps. All you can find out is whether iCloud is available to your app. The username is not available via any public API. The ubiquity container URL does not encode the iCloud user name, and neither does NSFileManager's ubiquityIdentityToken.

like image 113
Tom Harrington Avatar answered Sep 28 '22 02:09

Tom Harrington