private void OnAccountStatusComplete(CKAccountStatus accountStatus, NSError error) { if (error != null) { Debug.LogError(error.LocalizedDescription); } else { // Since AccoutStatuWithCompletionHandler is invoked everytime the Notification is sent // and the notification is sent for many reasons. You may want to check to see that the // account status has actually changed... // Compare the account status value against a cached version if (accountStatus != currentAccountStatus) { CKAccountStatus?oldAccountStatus = currentAccountStatus; currentAccountStatus = accountStatus; Debug.Log(string.Format("Account status changed from '{0}' to '{1}'", oldAccountStatus, currentAccountStatus)); } } }
private static void AccountStatusWithCompletionHandlerCallback(IntPtr thisPtr, ulong invocationId, CKAccountStatus accountStatus, IntPtr error) { var invocation = new InvocationRecord(thisPtr, invocationId); var executionContext = AccountStatusWithCompletionHandlerCallbacks[invocation]; AccountStatusWithCompletionHandlerCallbacks.Remove(invocation); executionContext.Invoke( accountStatus, error == IntPtr.Zero ? null : new NSError(error)); }
private static void AccountStatusWithCompletionHandlerCallback(IntPtr thisPtr, ulong invocationId, CKAccountStatus accountStatus, IntPtr error) { var invocation = new InvocationRecord(thisPtr, invocationId); var callback = AccountStatusWithCompletionHandlerCallbacks[invocation]; AccountStatusWithCompletionHandlerCallbacks.Remove(invocation); Dispatcher.Instance.EnqueueOnMainThread(() => callback( accountStatus, error == IntPtr.Zero ? null : new NSError(error))); }