我尝试在我的应用程序中使用CloudKit
订阅,但didReceiveRemoteNotification
没有被触发。
我保存CKSubscription
到CloudKit
. 为了确保它们存在,当应用程序启动时,我将它们绘制出来,例如:
<CKSubscription: 0x15576310; ; Query Subscription: recordType=DailyVote, predicate=TRUEPREDICATE, subscriptionOptions=7, subscriptionID=1FA456A6-9BA5-411D-97B9-1EB57121A5D0, zoneID=(null)> predicate: TRUEPREDICATE subscriptionType: (Enum Value) subscriptionOptions: C.CKSubscriptionOptions
我尝试按照苹果文档的建议在 APN 服务器上注册我的设备,但错误委托方法被调用,并显示消息:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert, categories: nil))
application.registerForRemoteNotifications()
return true
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
println("error: \(error.localizedDescription)")
//error: no valid aps-environment entitlement found for application
}
CloudKit
功能开启- 我没有无效的配置文件
- 我已经成功了:
Xcode
>Preferences
>Accounts
>pick your Account
>pick your Team
>View Details
>PRESS REFRESH BUTTON
- 我什至用新的 iCloud 容器创建了一个新的应用程序,移动了所有逻辑,但错误是一样的,订阅通知不起作用。