title: Service unavailable error (CKError Code 6) in CKContainer requestApplicationPermission
body: <p>I am trying to read user's name from their iCloud account using CloudKit as below</p>
  
  <pre><code>CKContainer *container = [CKContainer defaultContainer];
  [container accountStatusWithCompletionHandler:^(CKAccountStatus accountStatus, NSError * _Nullable error) {
      if (accountStatus == CKAccountStatusAvailable) {
          [container requestApplicationPermission:CKApplicationPermissionUserDiscoverability completionHandler:^(CKApplicationPermissionStatus applicationPermissionStatus, NSError * _Nullable error) {
              if (applicationPermissionStatus == CKApplicationPermissionStatusGranted) {
                  [container fetchUserRecordIDWithCompletionHandler:^(CKRecordID * _Nullable recordID, NSError * _Nullable error) {
                      if (!error &amp;&amp; recordID) {
                          [container discoverUserIdentityWithUserRecordID:recordID completionHandler:^(CKUserIdentity * _Nullable userInfo, NSError * _Nullable error) {
                              NSLog(@"UserInfo: %@  Error: %@", userInfo, error);
                          }];
                      }
                  }];
              }
          }];
      }
  }];
  </code></pre>
  
  <p>but every time <code>requestApplicationPermission</code> fails with Service Unavailable error and status is <code>CKApplicationPermissionStatusCouldNotComplete</code>. I am not sure what am I doing wrong here. I tried it with multiple devices and accounts but still result is same. I have tried disabling and enabling CloudKit in capabilities as was suggested in some places but no luck. Is there any information that I need to configure which I am missing. Below is how my iCloud capability looks</p>
  
  <p><a href="https://i.stack.imgur.com/gs9ib.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gs9ib.png" alt="iCloud Capability Configuration"></a></p>