Question

I have this normal code for notification alert:

- (void)saveNotification {
Class cls = NSClassFromString(@"UILocalNotification");
if (cls != nil) {

    UILocalNotification *notif = [[cls alloc] init];
    notif.fireDate = [[datePicker date] dateByAddingTimeInterval:-20];
    notif.timeZone = [NSTimeZone defaultTimeZone];

    notif.alertBody = @"Evaluation Planner";
    notif.alertAction = @"Details";
    notif.soundName = UILocalNotificationDefaultSoundName;
    notif.applicationIconBadgeNumber = 1;

    NSDictionary *userDict = [NSDictionary dictionaryWithObject:reminderText.text
                                                         forKey:kRemindMeNotificationDataKey];
    notif.userInfo = userDict;

    [[UIApplication sharedApplication] scheduleLocalNotification:notif];
    [notif release];
   }
}


- (void)showReminder:(NSString *)text {

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder" 
                                                    message:text delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
[alertView show];
[alertView release];
}

This works perfectly well for me but when I click onto "Details", I want it to be redirected to a particular page. Instead this only redirect to the main page of the application and I have to click through the whole app all the way to the reminder section to view it. I'm not exactly sure how to fix it. Do help me.

Thanks.

Was it helpful?

Solution

Your app delegate method application:didFinishLaunchingWithOptions: will get called with a notification payload. It's all documented well in Local and Push Notification Programming Guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top