1
나는 객관적인 C 응용 프로그램이 있습니다. 나는 시간 간격으로 UILocalNotifications를 보여줍니다. 그런 다음이를 추가하여 결정된 알림을 표시하지 않겠습니다.UILocalNotification을 표시 할 수 있습니까?
예를 들어 알림에 키와 값을 추가하고 didReceiveLocalNotification 함수에서받은 알림에 key = 2가 있으면 표시하고 싶지만 알림에 key = 1이 있으면 표시하지 않겠습니다.
이것이 가능합니까?
이 코드와이 노력하고있어,하지만 항상 모든 알림 보여 주었다됩니다
UILocalNotification *notification = [[UILocalNotification alloc] init];
//notification.fireDate = [[NSDate date] dateByAddingTimeInterval:1];
notification.alertBody = @"Hello!";
notification.soundName = @"Alarm-Clock.caf";
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"key1", @"1", nil];
notification.userInfo = infoDict;
notification.repeatInterval = NSCalendarUnitMinute;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
if([[notification.userInfo valueForKey:@"1"] isEqual:@"key1"]){
[[UIApplication sharedApplication] cancelLocalNotification:notification];
}
UILocationNotification이 해지되기 전에 무엇을 의미합니까? 이걸 didReceiveLocalNotification으로 부를 수 있을까요? 먼저 UILocalNotification을 추가 한 다음 1 분 후에 표시하지 않으려 고합니다. 희망은 분명하고 답을 주셔서 감사합니다. – user3745888
예. 다음 알림이 시작되지 않았기 때문에'didReceiveLocalNotification'을 호출 할 수 있습니다. 취소됩니다. – iphonic