So far I was unable to make subscriptions to work. (receive a push notification on my device, subscriptions appears to be created successfully)
I have been playing with [CloudKitAtlas][1]. I did what it's told on the readme for that proyect:
Requirements
Build
- iOS 8.0 SDK and Xcode 6
- Enable the CloudKit entitlement in iCloud (from Capabilities)
- Change your container name to provision a container in your developer account
I'm able to launch the app, it registers successfully for remote notifications:
2014-06-09 11:15:17.712 CloudKitAtlas[841:220562] Registered for Push notifications with token:
I'm also able to create records, query them and subscribe:
2014-06-09 11:15:21.966 CloudKitAtlas[841:220934] Subscribed to Item
And if I go to the dashboard I see several subscriptions created. But then when I create a new record nothing happens, the callback:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)info
Is never executed (Note: I'm running the app on a iPhone 5S, not on the simulator)
I'm using a debug signature with explicit bundle id (no wildcard) and for this app id I also created the corresponding push notifications certificates although I just downloaded them as I have nothing to do with those files.
- Am I forgetting to do something?
- Am I not testing it properly?
- Does anyone manage to get remote notifications on his device triggered by a subscription?
Update 15 / 06 / 14 Apparently it's a bug on apple side, let's wait a couple of weeks. https://developer.apple.com/library/content/samplecode/CloudAtlas/Introduction/Intro.html#//apple_ref/doc/uid/TP40014599
Update 18 / 05 / 15
In case anyone is wondering this bug was resolved by Apple long time ago and now it works like a charm, although you need to make some considerations:
- Make sure the saveSubscription:completionHandler: method executes without errors
- If you use [application registerForRemoteNotifications]; You will ONLY get notifications with the app on foreground, it might look like is pointless but it is very useful as this kind of push notifications are "silent" and you don't require user permission to use them
- If you want to get old fashion push notifications with the pop up asking for permission and an alert that appears outside of the app and everything you need to use something like:
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes: UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert categories:nil];
[application registerUserNotificationSettings:settings];
That's all