I try to use CloudKit subscriptions in my app, but didReceiveRemoteNotification not get triggered.
I saved CKSubscription to CloudKit. To be sure they exists, when app starts, I plot them out, like:
<CKSubscription: 0x15576310; ; Query Subscription: recordType=DailyVote, predicate=TRUEPREDICATE, subscriptionOptions=7, subscriptionID=1FA456A6-9BA5-411D-97B9-1EB57121A5D0, zoneID=(null)> predicate: TRUEPREDICATE subscriptionType: (Enum Value) subscriptionOptions: C.CKSubscriptionOptions
I try to register my device at APN server, as apple doc recommend, but error delegate method get called, with message:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert, categories: nil))
application.registerForRemoteNotifications()
return true
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
println("error: \(error.localizedDescription)")
//error: no valid aps-environment entitlement found for application
}
CloudKitcapability is on- I have no invalid provision profile
- I have done the trick:
Xcode>Preferences>Accounts>pick your Account>pick your Team>View Details>PRESS REFRESH BUTTON - I even created a fresh App, with new iCloud Container, moved all the logic, but the error is the same and subscription notification does not work.