CKModifyBadgeOperation无缘无故崩溃

时间:2015-12-15 16:20:44

标签: ios swift2 cloudkit

我已经为insert&创建了一个订阅它发送推送通知如下

let subscriptionNotification = CKNotificationInfo()

subscriptionNotification.alertBody = "New Book has been created by Author"

subscriptionNotification.shouldBadge = true

subscription.notificationInfo = subscriptionNotification

当我收到通知时,我会打开应用程序&我只是想将徽章重置为零

let resetBadge = CKModifyBadgeOperation(badgeValue: 0)

    resetBadge.modifyBadgeCompletionBlock = {(error) in

        if error != nil {

            print(error)

        }
        else {

            application.applicationIconBadgeNumber = 0

        }

    }

    CKContainer.defaultContainer().addOperation(resetBadge)

我在appdelegate上运行此代码,并使用options方法完成启动。 我得到以下错误。请注意,项目名称为 ckreference demo

  

2015-12-15 21:41:58.417 ckreference demo [2486:1478837] - [CKNotification queryNotificationReason]:无法识别的选择器发送到实例0x15cd8a960   2015-12-15 21:41:58.427 ckreference demo [2486:1478837] *由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [CKNotification queryNotificationReason]:无法识别的选择器发送到实例0x15cd8a960'   * 第一次抛出调用堆栈:   (0x183521900 0x182b8ff80 0x18352861c 0x1835255b8 0x18342968c 0x1000b8b9c 0x1000b9250 0x1884cbae4 0x1884b9de0 0x184ad7790 0x184ad7b10 0x1834d8efc 0x1834d8990 0x1834d6690 0x183405680 0x184914088 0x18827cd90 0x1000b94d0 0x182fa68b8)   libc ++ abi.dylib:以NSException类型的未捕获异常终止

有关如何阻止应用崩溃的任何建议?

崩溃发生在这里

enter image description here

0 个答案:

没有答案