title: Retrieve current iCloud account information in Xcode
body: <p>How to get current active iCloud account username in iOS device to show it in my application?</p>
  
  <p><em>Code from the comment below by OP</em></p>
  
  <pre><code>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"); 
  }
  </code></pre>
  
  <p>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.</p>