为什么没有调用didReceiveRemoteNotification?

时间:2016-06-15 16:57:28

标签: ios cloudkit subscription

我正在尝试使用CloudKit创建订阅,以便在每次创建记录时触发。我已经成功创建了订阅,我可以在仪表板中看到它,但我注意到我在 didReceiveRemoteNotification 中的打印件从未打印过!

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {

    print("oioioioioi")

    let viewController: CurrentEventController = self.window?.rootViewController as! CurrentEventController

    if let userInfo = userInfo as? [String: NSObject] {

        let notification: CKNotification = CKNotification(fromRemoteNotificationDictionary: userInfo)

        if (notification.notificationType == CKNotificationType.Query) {

            let queryNotification = notification as! CKQueryNotification

            let recordID = queryNotification.recordID

            viewController.fetchRecord(recordID!)
        }
    }
}

感谢您的帮助!

0 个答案:

没有答案