Preetha Preetha - 5 months ago 19
iOS Question

EKCalendar on my ipad application

Actually i want access the Native Calendar on my application,Referred so many links but still could not done that process,and the events are shown on my calendar and setting the time and date based alert the user also,any solution for me much appreciated,Thank you.

Answer

Finally i found an solution for this.

In appdelegate


(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Reminder"
                                                    message:notification.alertBody
                                                   delegate:self cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
    [alert show];

}

// Request to reload table view data
[[NSNotificationCenter defaultCenter] postNotificationName:@"Notification" object:self];

}

Create the reminder UILocalNotification* localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = pickerDate; localNotification.alertBody = self.EventText.text; localNotification.soundName=UILocalNotificationDefaultSoundName; localNotification.alertAction = @"Show me the item"; localNotification.timeZone = [NSTimeZone defaultTimeZone];

    localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] +1;
    NSUserDefaults *Defaults=[NSUserDefaults standardUserDefaults];
    [Defaults setObject:dateString forKey:@"eventdate"];
    NSLog(@"Datepicker Date..%@",dateString);

    [Defaults synchronize];
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

    // Request to reload table view data
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Notification" object:self];

    // Dismiss the view controller
    [self.navigationController popViewControllerAnimated:YES];