no valid 'aps-environment' entitlement string found for application in Notifications app

时间:2015-07-08 15:38:31

标签: ios notifications

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

And my code is :

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

    application.registerUserNotificationSettings( settings )
    application.registerForRemoteNotifications()

And I received this error: no valid 'aps-environment' entitlement string found for application

I searched a lot and I used all possible solutions and I retried again but nothing changed!!

3 个答案:

答案 0 :(得分:8)

我在Xcode 8中遇到过这个问题。 您必须启用Target-> capabilities->推送通知。 检查屏幕截图。enter image description here

答案 1 :(得分:2)

该消息告诉您,没有为用于签署您的应用程序的配置文件启用推送通知。您可能正在使用默认的Xcode开发配置文件对其进行签名。

在教程中(这是一个非常好的教程,我也在第一次推送通知中使用它),注意制作配置文件部分,并确保这个特定的配置文件在构建期间使用(您可以在“项目设置”中更改此项)。

答案 2 :(得分:0)

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