在推送通知警报上按“确定”后解析应用程序崩溃

时间:2015-09-17 19:37:20

标签: parse-platform push-notification ios9

我没有任何代码处理或在didReceiveRemoteNotification方法中创建新的UIAlertView。简单地..

PFPush.handlePush(userInfo)

if application.applicationState == UIApplicationState.Active {
  print("active")
}

当我在警告上按“确定”时,应用程序崩溃了exec_bad_access,堆栈卡在下面的完成(NSNotFound)行。

 if ([UIAlertController class] != nil) {
    __block UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
                                                                                     message:message
                                                                              preferredStyle:UIAlertControllerStyleAlert];

    void (^alertActionHandler)(UIAlertAction *) = [^(UIAlertAction *action){
        // This block intentionally retains alertController, and releases it afterwards.
        if (action.style == UIAlertActionStyleCancel) {
            completion(NSNotFound);
        } else {
            NSUInteger index = [alertController.actions indexOfObject:action];
            completion(index - 1);
        }
        alertController = nil;
    } copy];

0 个答案:

没有答案