CloudKit推记录更新通知停止工作 [英] CloudKit push notifications on record update stopped working

查看:369
本文介绍了CloudKit推记录更新通知停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改
复检今天2015年8月27日,它再次工作,苹果已经固定它。

EDIT: Retested today 27.08.2015 and it works again, Apple has fixed it.

我在开发模式下的应用程序。该应用程序使用CKSubscription得到在服务器上的更改通知,配置了所有三个选项:创建,更新,删除。一切都工作正常,但最近在回归测试我发现该应用程序不接收记录更新的通知,在创建和删除的通知仍在工作。该susbcription类型正确设置对于这三种选项,因为我检查了仪表盘和应用程序注册了CKSubscription因为它是一个几天前,当它工作般的魅力。我没有收到来自CloudKit任何错误。开发环境的复位没有帮助。我已经与我确信这是工作,并得到了相同的结果的版本重新测试。

I have an application in development mode. The application uses CKSubscription to get notified on changes on the server, configured for all three options: create, update, delete. Everything was working fine but recently during regression tests I have discovered the application does not receive notifications on record updates, the create and delete notifications are still working. The susbcription types are set correctly for all three options as I checked on the dashboard and the application is registered for CKSubscription as it was a couple of days ago when it was working like charm. I am not getting any errors from CloudKit. The reset of development environment did not help. I have re-tested with the version with which I am sure it was working and got the same results.

任何想法可能会造成这个问题,我还需要检查/尝试一下呢?

Any idea what might be causing this issue, what else should I check / try?

其他信息:
我想的东西可能出错在服务器端。反正也是它被工作没有得到更新通知,再版本 - 在我预订了CloudKit事件和处理推送通知,我还没有在code改变任何东西。我工作的应用程序发布,从而改变容器没有去。不知道这可能是导致该问题,只想提及:应用程序使用的是同一个容器在云中存储的核心数据 - 应用升级的目标是将数据迁移到CloudKit并用它作为云计算存储完全。这是混淆这一切是为周工作的罚款,并突然停了下来,没有任何明确的理由的工作,可能是由密集的测试负载的影响,增加记录类型...

Additional Info: I guess something might go wrong at the server side. I have not changed anything in the code where I am subscribing for CloudKit events and handling push notifications - anyway also the version where it was working is not getting update notifications any longer. The application I am working on is published, thus changing container is no go. Not sure if this might be causing the issue, just want to mention: the app is using the same container for storing the Core Data in the cloud - the goal of the app upgrade is to migrate data to the CloudKit and use it as the cloud storage exclusively. It is confusing that everything was working fine for weeks and suddenly stopped working without any clear reason, probably as the effect of the load by intensive testing, adding record types...

与从头开发应用测试:
我写了一个简单的测试程序来检查接收通知。我只能接收纪录创造通知。有什么不对我的code:

Test with app developed from scratch: I have written a simple test app to check receiving notifications. I can receive only the notification on record creation. What is wrong with my code:

import UIKit
import CloudKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

let container = CKContainer.defaultContainer()

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    let settings = UIUserNotificationSettings(forTypes: .Alert, categories: nil)
    application.registerUserNotificationSettings(settings)
    application.registerForRemoteNotifications()

    return true
}

func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
    println("didFailToRegisterForRemoteNotificationsWithError: \(error)")
}

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    println("didRegisterForRemoteNotificationsWithDeviceToken: \(deviceToken)")
    subscribe()
}

func subscribe() {
//        let predicate = NSPredicate(format: "text != %@", argumentArray: [""])
//        let predicate = NSPredicate(format: "TRUEPREDICATE", argumentArray: nil)
    let predicate = NSPredicate(value: true)
    let subscription = CKSubscription(recordType: "Note", predicate: predicate, options: .FiresOnRecordDeletion | .FiresOnRecordUpdate | .FiresOnRecordCreation)
    let notificationInfo = CKNotificationInfo()
    notificationInfo.alertBody = ""
    subscription.notificationInfo = notificationInfo
    let publicDatabase = container.publicCloudDatabase
    println("subscribing with CloudKit...")
    publicDatabase.saveSubscription(subscription, completionHandler: { (returnedSubscription, error) -> Void in
        if let error = error {
            println("subscription error \(error.localizedDescription)")
        } else {
            println("subscription ok")
        }
    })
}

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    let ckNotification = CKQueryNotification(fromRemoteNotificationDictionary: userInfo)
    println("didReceiveRemoteNotification: \(ckNotification)")
}

func applicationWillResignActive(application: UIApplication) {}

func applicationDidEnterBackground(application: UIApplication) {}

func applicationWillEnterForeground(application: UIApplication) {}

func applicationDidBecomeActive(application: UIApplication) {}

func applicationWillTerminate(application: UIApplication) {}

}

推荐答案

我经历了过去这种行为。在我来说,我可以只删除订阅并重新创造它解决它。你应该这样做,从code,而不是仪表盘。从仪表板做它仅适用于您在loged入仪表板的帐户。

I have experienced this behavior in the past. In my case I could solve it by just deleting the subscription and creating it again. You should do that from code and not the dashboard. Doing it from the dashboard only works for the account that you are loged in into the dashboard.

这篇关于CloudKit推记录更新通知停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆