There is no valid aps-environment permission string for the app in the Notifications app

I want to use notifications in my iOS app I read a lot of tutorials and I used this: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

And my code:

var types: UIUserNotificationType = UIUserNotificationType.Badge |
        UIUserNotificationType.Alert |
        UIUserNotificationType.Sound
    var settings: UIUserNotificationSettings = UIUserNotificationSettings( forTypes: types, categories: nil )

    application.registerUserNotificationSettings( settings )
    application.registerForRemoteNotifications()

      

And I got this error: There is no valid aps-environment permission string for the application

I searched a lot and I used every possible solution and tried again but nothing changed !!

+3


source to share


3 answers


I faced this problem in Xcode 8. You need to enable the Target-> capability-> push function. Check the screenshotenter image description here



+8


source


The message says push notifications are not enabled for the provisioning profile that is used to sign your app. You are probably signing it with the default Xcode development profile.



In the tutorial (it's pretty good, I used it for my first push notifications as well), take a look at the Create a Provisioning Profile section and make sure this profile is used at build time (you can change this in your project settings).

+2


source


I think "aps-environment" will be in provisioning profiles. I would check if the provisioning profiles "push notifications" are enabled.

0


source







All Articles