No CloudKit notifications on MacOS

Running into problems? This is a good place to get technical assistance for anything that isn't considered a bug.
shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

No CloudKit notifications on MacOS

Post by shaynay »

Hello,

I am not able to receive notifications on a MacOS build with HovelHouse Plugin. I am making a development build and I followed all the steps here:
http://www.hovelhouse.com/building_for_macos.html
and here:
http://www.hovelhouse.com/tutorial_subscriptions.html

By the way, thank you for these pages !

So, my app is running, and I've been able to create a record and a subscription. The only thing which differs in my subscription from the one in the sample is the predicate, with the following format:

Code: Select all

var predicate = NSPredicate.PredicateWithFormat("clubId = '" + clubId + "'");
But this doesn't seem to be the problem. What I observe is that the RequestNotificationToken delegate is never called but well registered, as you can see in the log bellow:
[MainMenuGameMode] Requesting notification token
[11862:90268] [HovelHouse-CloudKit] request notification token
[11862:90268] Added instance method `application:didRegisterForRemoteNotificationsWithDeviceToken:` of OverrideAppDelegate to PlayerAppDelegate with success
[11862:90268] Added instance method `application:didFailToRegisterForRemoteNotificationsWithError:` of OverrideAppDelegate to PlayerAppDelegate with success
[11862:90268] Added instance method `application:didReceiveRemoteNotification:` of OverrideAppDelegate to PlayerAppDelegate with success
[11862:90268] Set notification handler...
[11862:90268] CKContainer_defaultContainer()
[11862:90268] Set notification handler...
and right after is the log about subscriptions:
You have the following subscriptions: <subscription id>
while there should be at least one of these log :

Code: Select all

if (error != null)
            {
                Debug.LogError("Failed to get push notification token: " + error.LocalizedDescription);
            }
            else
            {
                Debug.Log("Got push notification token");
            }
I really don't get what's wrong. Any help would be much appreciated. Thank you !

Shay

admin
Site Admin
Posts: 49
Joined: Thu Mar 19, 2020 8:52 pm

Re: No CloudKit notifications on MacOS

Post by admin »

Thank you for the report Shay,

I will attempt to reproduce on my end today and hopefully get you some answers. In the meantime, can you provide me with the following?
  • the unity version you are running
  • the package version of the plugin
  • your macOS version
Cheers,

shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

Re: No CloudKit notifications on MacOS

Post by shaynay »

Thanks for the quick answer, yes here are the information you asked:
  • Unity Version 2020.1.17f1
  • HovelHouse Version 1.1.6
  • macOS Big Sur Version 11.0.1
Cheers

admin
Site Admin
Posts: 49
Joined: Thu Mar 19, 2020 8:52 pm

Re: No CloudKit notifications on MacOS

Post by admin »

Hi Shay,

I have some more information for you. I tested the demo project on both Catalina (10.15.7) and BigSur (11.2) build from Unity version 2020.1.17f1. It works on Catalina, but I see the bug in BigSur. I did some googling and other developers are experiencing similar issues in BigSur.

Check out this link:
https://jaanus.com/big-sur-remote-notifications

This user says that applications build with the development APS environment do not work, but that they had success using the production environment. It may be worth trying out. If you happen to do so, please keep us updated in this thread on whether or not it worked.

There is also some chatter on Twitter that this bug was fixed in the BigSur 11.2 beta, but I don't think that this fix made it into the 11.2 release. I'm running 11.2 and I still see the issue. So do other devs in https://developer.apple.com/forums/thread/660180

Sadly (and irresponsibly), Apple keeps their bug database private. There is no way to track how many users this is affecting, or when to expect a fix. Hopefully, they will patch it soon.

shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

Re: No CloudKit notifications on MacOS

Post by shaynay »

Hi :)

I couldn't make the app work with a production environment. I got a message saying "you are not allowed to use this app" when I add the entitlement "com.apple.developer.icloud-container-environment : production".
It surely has something to do with provisioning profiles and or certificates.
Anyway I can't investigate further now so I'll get back do you when I can.

Thank you very much for your answers though, I hope they'll fix this soon.

shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

Re: No CloudKit notifications on MacOS

Post by shaynay »

Hello,

I am still having troubles requesting for the notification token, this time on iOS. The same thing happens as on macOS => the ICloudNotifications.RequestNotificationToken callback is never called.

Here are the relevant logs
2021-03-16 10:59:01.422803+0100 [13348:2090963] Added instance method `application:didReceiveRemoteNotification:fetchCompletionHandler:` of OverrideAppDelegate to UnityAppController with success
2021-03-16 10:59:01.423190+0100 [13348:2090963] Added instance method `application:didRegisterForRemoteNotificationsWithDeviceToken:` of OverrideAppDelegate to UnityAppController with success
2021-03-16 10:59:01.423436+0100 [13348:2090963] Added instance method `application:didFailToRegisterForRemoteNotificationsWithError:` of OverrideAppDelegate to UnityAppController with success
2021-03-16 10:59:01.423650+0100 [13348:2090963] Added instance method `application:didReceiveRemoteNotification:` of OverrideAppDelegate to UnityAppController with success
2021-03-16 10:59:01.423783+0100 [13348:2090963] [HovelHouse - CloudKit] registering for remote notifications
2021-03-16 10:59:01.431512+0100 [13348:2090963] CKContainer_defaultContainer()
2021-03-16 10:59:01.447382+0100 [13348:2090963] Set notification handler...

You have the following subscriptions: <subscription_id>
The device's OS is iOS 14.4

Still running the sample code :

Code: Select all

Eden.Common.Logger.LogError(GetType().Name, "====  subscriptions  ======");
            Eden.Common.Logger.LogError(GetType().Name, "Example 9 - Subscriptions");

            Eden.Common.Logger.LogError(GetType().Name, "Requesting notification token");

            ICloudNotifications.RequestNotificationToken((tokenBytes, error) => { // we never run this callback code (based on the logs)
                Eden.Common.Logger.LogError(GetType().Name, "Request token delegate");
                if (error != null)
                {
                    Eden.Common.Logger.LogError(GetType().Name, "Failed to get push notification token: " + error.LocalizedDescription);
                }
                else
                {
                    Eden.Common.Logger.LogError(GetType().Name, "Got push notification token");
                }
            });
On the device, the app has no Notification Settings (Settings -> Notification -> (can't find the app)) or (App Settings -> (no notification settings)).

Any clue on what's causing this ?

Thanks.

Shay

shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

Re: No CloudKit notifications on MacOS

Post by shaynay »

Hi again,

Maybe the problem is simple... Silly question :
In Unity, in order to receive cloudkit notifications, do I still need to do what's described here : https://docs.unity3d.com/Packages/com.u ... l/iOS.html ?

I'll try this

Cheers,
Stéphane

shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

Re: No CloudKit notifications on MacOS

Post by shaynay »

Hello,

I come with some news. Since I added the Unity Mobile Notification package I finally obtained a token !

But still notifications are not arriving on the device (the handler is never called). I switched back to a predicate(true) so I should receive a notification on every database modification.

I can see a push though in the cloudkit dashboard logs :
Image

Any idea ? Nothing is printed in APNS env, and the hardware is UNKNOWN although it is an iPhone 8 device...

I wonder if that can be the problem here ?

Thanks

Shay

shaynay
Posts: 8
Joined: Wed Feb 03, 2021 11:01 am

Re: No CloudKit notifications on MacOS

Post by shaynay »

Hello,

I just added this:

Code: Select all

notificationInfo.ShouldSendContentAvailable = true;
to the CKNotificationInfo when creating the subscription

And I received notification on iOS !
I think that boolean is missing in the sample to make it work properly.

Keep you in touch for macOS

Thanks

Shay

Post Reply