Search code examples
iospush-notificationsynchronizationcloudkit

CloudKit iOS 9.0 didReceiveRemoteNotification not called after iOS 9.3 released


I have an iPod Touch with iOS 9.0 that isn't receiving CloudKit CKSubscription push notifications after the release of iOS 9.3.

My iPad with iOS 9.3 is receiving the notifications just fine, using the same build of the app.

Does anyone know what's going on here? Do certain CloudKit versions no longer push notifications to older versions?

When I delete and reinstall the app on my iPod Touch, I tap "Allow" to allow push notifications, but if I make any record changes in my CloudKit dashboard, only my iPad receives the push notification, and didReceiveRemoteNotification is not even called on my iPod Touch.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        // Register for push notifications
        let notificationSettings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert, categories: nil)
        application.registerUserNotificationSettings(notificationSettings)
        application.registerForRemoteNotifications()

        return true
}

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
}

Solution

  • The solution was rather tricky. In my Xcode project, there was an *.entitlements file that had the name of my app icon (as displayed on a device). However, my project's name is different than this *.entitlements file:

    My file: ABC.entitlements (my app shows up as ABC on a device)

    My project's name: XYZ

    So I tried to change the name of the entitlements file to XYZ.entitlements, but Xcode gave me a warning that there was already a file named XYZ.entitlements. It turns out there was another *.entitlements file in my Supporting Files folder. This entitlements file didn't have any iCloud settings.

    In reality, this shouldn't matter because in my build settings, the entitlements file path is set to ABC.entitlements, but for some reason, with my iPod Touch's iOS 9.0.1, it seemed to be using the XYZ.entitlements file (my assumption).

    I deleted the XYZ.entitlements file from my project, and also included the ABC.entitlements file in my target membership. After this, my iPod Touch was able to receive CloudKit notifications again.

    Thanks for your help!