Ios's simple reminder management class can be used as an alarm clock

Source: Internet
Author: User

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];}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.