没有为通知应用程序中的应用程序找到有效的"aps-environment"权利字符串

ima*_*zen 3 notifications ios

我想在我的iOS应用程序中使用通知我阅读了很多教程并使用了这个:http: //www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

我的代码是:

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

    application.registerUserNotificationSettings( settings )
    application.registerForRemoteNotifications()
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:没有为应用程序找到有效的'aps-environment'权利字符串

我搜索了很多,我使用了所有可能的解决方案,我再次重试但没有改变!

Dip*_*ara 8

我在Xcode 8中遇到过这个问题.您必须启用Target-> capabilities-> push notification.检查屏幕截图.在此输入图像描述