Отменить локальное уведомление не работает

Я потратил половину дня, читая все вопросы и ответы "Как отменить локальное уведомление". В конце концов, я придумал собственное решение, но, видимо, оно не работает. У меня есть табличное представление со всеми моими запланированными уведомлениями ....

в H-файле у меня есть

@property (strong, nonatomic) UILocalNotification *theNotification;

, а затем в M-файле:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSArray *notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
    theNotification = [notificationArray objectAtIndex:indexPath.row];
    NSLog(@"Notification to cancel: %@", [theNotification description]); 
    // NSLOG Perfectly describes the notification to be cancelled. But then It will give me      "unrecognized selector"


    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Local Reminder"
                                                    message:@"Cancel local reminder ?"
                                                   delegate:self
                                          cancelButtonTitle:@"No"
                                          otherButtonTitles:@"Yes", nil];
    [alertView show];
    [alertView release];    
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        NSLog(@"Cancel");
    }else{ 
        NSLog(@"Ok");
        [[UIApplication sharedApplication] cancelLocalNotification:theNotification];
    }
}

Если я нажимаю «ОК», я получаю: 2012-02-04 03: 34: 48.806 Третий тест [8921: 207] - [__ NSCFType encodeWithCoder:]: нераспознанный селектор отправлен в экземпляр 0x890ae90 Программа получила сигнал «SIGABRT».

Если я могу полностью идентифицировать уведомление, которое нужно отменить, почему оно мне это дает?

7
задан Shmidt 14 October 2015 в 20:16
поделиться