小编Amm*_*pan的帖子

当我添加超过1000的多个本地通知时,iPhone重新启动

在我的基于日历的应用程序中,我还从我的应用程序创建了所有事件的本地通知.

在每次发布时,我删除所有通知并创建2年.所以,它的1000以上事件就在那里.

当本地通知创建设备内存高达80 MB时.但没有创建我的应用程序只使用75而且能源使用非常高的 设备产生热量并且每次都自动重启,所以即使我也无法获得崩溃日志.

我收到日志:

XPC连接中断[Common]终止,因为没有系统应用程序.

注意:我的应用程序最低IOS是:iOS 9.仅在nsoperation上创建通知.高级谢谢你的帮助.

    -(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];
      }
}
Run Code Online (Sandbox Code Playgroud)

我将在循环上调用上面的函数.

objective-c nscalendar ios uilocalnotification ekevent

5
推荐指数
0
解决办法
119
查看次数