"로컬 알림을 취소하는 방법"질문과 대답을 읽는 데 하루 중 절반을 보냈습니다. 결국, 내 솔루션을 생각해 냈지만 분명히 작동하지 않습니다. 내 모든 스케줄 통지와의 tableview이 ....가 H 파일에로컬 알림 취소 작동하지 않음
나는 M 파일에 다음
@property (strong, nonatomic) UILocalNotification *theNotification;
하고 있습니다 : 내가 확인 "을 클릭하면
- (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 ".
취소 할 알림을 완전히 식별 할 수있는 이유는 무엇입니까? 내 응용 프로그램에서
컨트롤러를 닫을 필요가없는 방법을 찾으려고했습니다. 2 - 삭제되는 알림을 시각화합니다. 3 - 매번 특정 키를 설정할 필요가 없습니다. 귀하의 답변은 전적으로 유효합니다. 더 나은 시각적 결과를 위해 조금 더 노력해야했습니다. 그래도 고마워. 나는 받아 들여 투표 할 것이다. – Farini
이것은 _scheduled_ 알림에만 적용됩니다. 'presentLocalNotificationNow : '를 통해 제시된 통지를 취소하는 것처럼 보이지 않을 수 있습니다. 그것은 단지 나에게 1 년이 걸리는 것을 알았다! –
@Farini가 내 대답을 편집하여 자유롭게 편집 할 수 있습니다. :) – Shmidt