Ios's simple reminder management class can be used as an alarm clock
Add "your reminder" to the calendar or local notification conveniently and quickly
When more than 64 local notifications are automatically processed
If you have any questions or improvements regarding QQ group number 113767274, let's discuss them together.
Example 1: Send the following three UIApplication callbacks to LKAlarmManager.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[LKAlarmMamager shareManager] didFinishLaunchingWithOptions:launchOptions]; return YES;}-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ [[LKAlarmMamager shareManager] handleOpenURL:url]; return YES;}-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{ [[LKAlarmMamager shareManager] didReceiveLocalNotification:notification];}
2. Add a reminder to LKAlarmManager.
LKAlarmEvent * event = [LKAlarmEvent new]; event. title = @ add to calendar event; event. content = @ is useful only when it is added to the calendar. It is the remarks in the calendar. // workday reminder event. repeatType = LKAlarmRepeatTypeWork; // remind me of the event in 60 seconds. startDate = [NSDate dateWithTimeIntervalSinceNow: 60]; // You can also force it to a local reminder. // event. isneedjoinlocalpolicy = YES; // the system first tries to add the calendar. If the calendar has no permission, it will be added to the local reminder [[LKAlarmMamager shareManager] addAlarmEvent: event callback: ^) {dispatch_async (dispatch_get_main_queue (), ^ {UILabel * label = (ViewController *) _ window. rootViewController ). lb_haha; if (alarmEvent. isJoinedCalendar) {label. text = @ added calendar;} else if (alarmEvent. isJoinedLocalNotify) {label. text = @ added local notification;} else {label. text = @ failed to add notification;});}];
3. register the LKAlarmManager callback to do what you want when you receive the reminder.
/// Regist delegate [[LKAlarmMamager shareManager] Principal: self];-(void) Principal :( LKAlarmEvent *) event {UIAlertView * alertView = [UIAlertView alloc] initWithTitle: @ receive notification! Message: event. title delegate: nil cancelButtonTitle: @ confirm otherButtonTitles: nil]; [alertView show];}