2014-10-06 102 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

您所添加的設備到開發配置文件,然後下載並安裝它?直到設備被添加,我得到了相同的錯誤。