Reboot iPhone when adding multiple local notifications over 1000

In my calendar-based application, I also create a local notification for all events from my application.

Each time I start, I delete all notifications and create it within 2 years. so there are more than 1000 events.

When the local device notification memory reaches 80 MB. but without creating my application using only 75, and also using Energy, a very high device produces heat and automatically restarts every time, so even I can not get the alarm log.

I get a log:

XPC connection aborted [Common] Termination because there is no system application.

Notes. Minimum iOS application for my application: iOS 9. Create a notification only for nsoperation. Thanks for the help.

-(void)addLocalNotifiction:(EKEvent*)event andType:(NSString *)eventType andBody:(NSString*)body { @autoreleasepool { UILocalNotification *localNotification = [[UILocalNotification alloc] init]; NSDictionary *infoDict = @{@"identifier" : event.eventIdentifier ?: @"", @"calendarIdentifier" : event.calendar.calendarIdentifier ?: @"", @"date" : event.startDate ?: @"", @"type" : eventType, @"mode" : @"new"}; localNotification.alertBody = body; localNotification.userInfo = infoDict; localNotification.fireDate = event.alarms[0].absoluteDate; [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; } } 

I will call the function over the loop.

+5
source share

Source: https://habr.com/ru/post/1257515/


All Articles