5
votes

I am using MacCatalyst to port an iOS/iPadOS app to MacOS. The app uses CloudKit and functions in all ways except one: the UIApplicationDelegate method, didReceiveRemoteNotification, is not called on the MacOS version when a CloudKit update is submitted from another device

Things that do work in the app:

  • Submitting CKDatabaseOperations including updates and subscriptions to CloudKit
  • Manually retrieving database updates from CloudKit
  • UIApplicationDelegate method didRegisterForRemoteNotificationsWithDeviceToken fires and UIApplication.isRegisteredForRemoteNotifications returns true when calling UIApplication.registerForRemoteNotifications
  • Setting the CKSubscription.NotificationInfo to invoke an alert notification which displays properly in MacOS
  • UNUserNotificationCenterDelegate method, willPresent, when an alert notification is invoked and the app is in the foreground
  • didReceiveRemoteNotification on iOS and iPad (physical devices)

Has anyone had UIApplicationDelegate method, didReceiveRemoteNotification, called when using MacCatalyst?

Update: The app did eventually fire the didReceiveRemoteNotification method 30 minutes after an update was sent, but on other updates, the method is not fired even after hours. Any ideas?

Facing same issue in my project, Please share solution if you find solution. - Manikandan D
Are you using simulators when testing the iOS and iPad or real devices? If you are using simulators would recommend trying a few real devices. This, however, will not solve the problem just I found sometimes the simulators do not update correctly. For the delegate not being called, I do not have an answer but will think about that. - 117MasterChief96
I have a physical iPhone and iPad. They update to each other, and the Mac version pushes to the others just fine. The Mac version can pull updates manually, but it doesn't get notified when the other devices submit updates - NewEndian
Alright, I actually have had the same problem at times but it is not constant, but I have not found a solution. I am using Swift I do not know if you are using Swift or SwiftUI but personally I have a theory that it could be related to Swift and for it to work perfectly you have to use SwiftUI but I have not tested this idea. The reason I state this too is because all the examples at like WWDC, for instence, all used SwiftUI, but that could be unrelated too. - 117MasterChief96
@NewEndian have you figured out a solution to this? Facing the same issue - hyouuu