2014-10-06 104 views
0

我按照Parse.com上的指南了解如何创建证书并准备配置帐户以接受推送通知。当我去首/帐户: 它显示在底部,但是当我试图从生成设置选项卡中选择它,它不显示,我总是得到这个错误:"no valid 'aps-environment' entitlement string found for application"Apple - 配置文件+推送通知

Screenshot

我尝试了这个从零开始,使用几个Xcode &解析应用程序,请帮助我。

的appdelegate代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
     // Override point for customization after application launch. 

     Parse.setApplicationId("MyAppId", clientKey: "MyAppClientKey") 

     var notificationType: UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound 

     var settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationType, categories: nil) 
     UIApplication.sharedApplication().registerUserNotificationSettings(settings) 
     UIApplication.sharedApplication().registerForRemoteNotifications() 

     return true 
    } 

    func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) { 

     var currentInstallation: PFInstallation = PFInstallation() 
     currentInstallation.setDeviceTokenFromData(deviceToken) 
     currentInstallation.saveInBackground() 
    } 

    func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) { 

     println(error.localizedDescription) 
    } 

    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { 

     PFPush.handlePush(userInfo) 
    } 

回答

0

您所添加的设备到开发配置文件,然后下载并安装它?直到设备被添加,我得到了相同的错误。