按下" Ok" Parse崩溃收到pushNotification事件时的按钮

时间:2015-09-16 12:37:19

标签: ios objective-c parse-platform

在接收推送事件后,我正在呼叫:

[PFPush handlePush:userInfo];

然后提示用户提示,在按下UIAlertView后,应用程序崩溃

PFAlertView.m:

+ (void)showAlertWithTitle:(NSString *)title
                   message:(NSString *)message
         cancelButtonTitle:(NSString *)cancelButtonTitle
         otherButtonTitles:(NSArray *)otherButtonTitles
                completion:(PFAlertViewCompletion)completion {
    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) {

    // App is crashing on this line!!

        completion(NSNotFound); 
    //

    } else {
        NSUInteger index = [alertController.actions indexOfObject:action];
        completion(index - 1);
    }
    alertController = nil;
} copy];

应用程序崩溃,因为completion为null。(Parent为NULL)

其他人是否面临这个问题?我该怎么做才能解决这个问题?

0 个答案:

没有答案