Apple - 配置文件 + 推送通知
Posted
技术标签:
【中文标题】Apple - 配置文件 + 推送通知【英文标题】:Apple - Provisioning profile + Push Notifications 【发布时间】: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)
【问题讨论】:
【参考方案1】:您是否已将设备添加到开发配置文件中,然后下载并安装它?在添加设备之前,我遇到了同样的错误。
【讨论】:
以上是关于Apple - 配置文件 + 推送通知的主要内容,如果未能解决你的问题,请参考以下文章
Apple 推送通知 - 从生产应用程序获取空推送令牌 - 将在修复配置文件问题后发送推送令牌
推送通知在 Apple Beta 测试 (TestFlight) 中不起作用