// Start is called before the first frame update IEnumerator Start() { Debug.Log("Example 9 - Subscriptions"); Debug.Log("Requesting notification token"); ICloudNotifications.RequestNotificationToken((tokenBytes, error) => { if (error != null) { Debug.LogError("Failed to get push notification token: " + error.LocalizedDescription); } else { Debug.LogError("Got push notification token"); } }); ICloudNotifications.SetRemoteNotificationHandler((p) => { Debug.Log("remote notification handler called"); }); database = CKContainer.DefaultContainer().PrivateCloudDatabase; // You only need to register a subscription ONCE // So check that a subscription exists before trying to add one database.FetchAllSubscriptionsWithCompletionHandler(OnSubscriptionsFetched); ICloudNotifications.SetRemoteNotificationHandler(OnQueryNotification); yield break; }