Open Prashant961992 opened 7 years ago
I user following Code but Fire only 63 Notification, so How can fire More than 64 Notification in day.
for (int i=0; i<=100; i++) { MUMutableNotificationContent *mutableContent = [[MUMutableNotificationContent alloc] init]; mutableContent.body = [NSString stringWithFormat:@"body%d",i]; mutableContent.categoryIdentifier = @"category-identifier"; mutableContent.userInfo = @{@"key1": @"value1", @"key2": @"value2"}; mutableContent.sound = [MUNotificationSound defaultSound]; mutableContent.badge = @0;
NSString *selectedDataandTime = [NSString stringWithFormat:@"30-08-2017 11:18 AM"]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]]; [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; [dateFormatter setDateFormat:@"dd-MM-yyyy hh:mm a"]; NSDate *dateIs = [dateFormatter dateFromString:selectedDataandTime];; NSDate *mofifiedDate; mofifiedDate=[dateIs dateByAddingTimeInterval:60]; NSCalendar *calendar = [NSCalendar currentCalendar]; calendar.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; [calendar setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]]; NSDateComponents *components = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond) fromDate:mofifiedDate]; NSInteger day = [components day]; NSInteger month = [components month]; NSInteger year = [components year]; NSInteger hour = [components hour]; NSInteger minute = [components minute]; // NSInteger second = [[datewithsecond substringFromIndex: [datewithsecond length] - 2] integerValue]; // //Deliver the notification at sprcific time everyday NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; dateComponents.day = day; dateComponents.month = month; dateComponents.year = year; dateComponents.hour = hour; dateComponents.minute = minute; // dateComponents.second = second; NSLog(@"Fire Notification Time : \n %@",dateComponents); MUCalendarNotificationTrigger *trigger = nil; if (IS_IOS10_OR_GREATER) { trigger = [MUCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:false]; } else { trigger = [MUCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:false]; } MUNotificationRequest *mnf = [MUNotificationRequest requestWithIdentifier:[[NSUUID UUID] UUIDString] content:mutableContent trigger:trigger]; [[MUUserNotificationCenter currentNotificationCenter] addNotificationRequest:mnf withCompletionHandler:^(NSError * _Nullable error) { NSLog(@"addNotificationRequest erro: %@", error); }]; }
请参考 https://stackoverflow.com/questions/27737529/handle-multiple-uilocalnotification-more-then-64
if i tried to set multiple notification for et: startdate:30Aug2017,end date 20Sep2017,fivetime: time1 10am,11 am ,1 pm,2pm,3pm....then...set notification=days=20 rimender=5 then 20x5=100? how to fix it?
I user following Code but Fire only 63 Notification, so How can fire More than 64 Notification in day.
for (int i=0; i<=100; i++) { MUMutableNotificationContent *mutableContent = [[MUMutableNotificationContent alloc] init]; mutableContent.body = [NSString stringWithFormat:@"body%d",i]; mutableContent.categoryIdentifier = @"category-identifier"; mutableContent.userInfo = @{@"key1": @"value1", @"key2": @"value2"}; mutableContent.sound = [MUNotificationSound defaultSound]; mutableContent.badge = @0;