【问题标题】:Apple - Provisioning profile + Push NotificationsApple - 配置文件 + 推送通知
【发布时间】:2014-10-06 15:49:40
【问题描述】:

我按照 Parse.com 上有关如何创建证书和准备配置帐户以接受推送通知的指南进行操作。当我转到首选项/帐户时: 它显示在底部,但是当我尝试从“构建设置”选项卡中选择它时,它没有显示,并且我总是收到此错误:"no valid 'aps-environment' entitlement string found for application"

我从头开始尝试了几次,使用了几个 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)
    }

【问题讨论】:

    标签: xcode push-notification provisioning-profile


    【解决方案1】:

    您是否已将设备添加到开发配置文件中,然后下载并安装它?在添加设备之前,我遇到了同样的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多