János
János

Reputation: 35050

CloudKit + no valid aps-environment entitlement error

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
}

Upvotes: 0

Views: 645

Answers (2)

Geet
Geet

Reputation: 2437

the error mostly prompts that, the provisioning profile, which you have used, does not support the aps-environment, make sure that you refresh the provisioning profile after you have made modification in your app id,

try this out, open your Provisioning profile in a text editor and search for the following,

aps-environment

if you dont find this, then the problem is provisioning profile associated,if it does then try this out..

How to fix "no valid 'aps-environment' entitlement string found for application" in Xcode 4.3?

Upvotes: 0

J&#225;nos
J&#225;nos

Reputation: 35050

Even though Apple Doc says here: You don’t need to enable push notifications for the app’s explicit App ID in Member Center to receive subscription notifications. Xcode automatically adds the APNs entitlement to your entitlement file when you enable CloudKit.

If you add Push Notification in Developer Portal under App IDs it will work, or at least for second try for me it worked.

Upvotes: 2

Related Questions