6 つの UILocalNotifications があります。すべての通知には独自の「userInfo」があります
- @"1"
- @"2"
- @"3"
- @"4"
- @"5"
- @"6"
次に、通知番号4を削除し、5つの通知を取得します:
- @"1"
- @"2"
- @"3"
- @"5"
- @"6"
通知で「userInfo」を変更して取得する方法:
- @"1"
- @"2"
- @"3"
- @"4"
- @"5"
コードを保存 -
// Specify custom data for the notification
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%i", i] forKey:@"notif"];
localNotif.userInfo = infoDict;
i = i + 1;
デルコード -
if (flagTable == 1)
{
int numberPhoto = [[[UIApplication sharedApplication] scheduledLocalNotifications] count];
int numPhFlag = numberPhoto;
int i = 0;
NSLog(@"Col notif = %d", numberPhoto);
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
while (numberPhoto == numPhFlag) {
localNotif = [[[UIApplication sharedApplication] scheduledLocalNotifications] objectAtIndex:i];
localNotif.timeZone = [NSTimeZone localTimeZone];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"dd-MM-yyyy HH:mm"];
NSString *itemDateWithFormat = [format stringFromDate:localNotif.fireDate];
NSLog(@"remText2 %@ = fireDate2 %@", itemDateWithFormat, [appDel.fireDateArray objectAtIndex:row]);
if ([itemDateWithFormat isEqualToString:[appDel.fireDateArray objectAtIndex:row]]) {
NSLog(@"remText3 %@ = fireDate3 %@", itemDateWithFormat, [appDel.fireDateArray objectAtIndex:row]);
[[UIApplication sharedApplication] cancelLocalNotification:localNotif];
numPhFlag = numPhFlag - 1;
}
i = i + 1;
}
int getNot = [[[UIApplication sharedApplication] scheduledLocalNotifications] count];
NSLog(@"Col notif2 = %d", getNot);
}
通知を繰り返し処理し、userInfo のデータを置き換えたいと考えています。