简体   繁体   中英

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

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!!

I have faced this issue in Xcode 8. You must have to enable Target—> capabilities—> push notification. Check the screenshot. 在此输入图像描述

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

In the tutorial (which is quite a good one, I used it too for my first push notifications), pay attention to the Making the Provisioning Profile section, and make sure that this particular provisioning profile is used during the build (you can change this in the Project Settings).

我认为'aps-environment'会出现在配置文件中。我会检查配置文件中是否启用了“推送通知”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM