ios - iPhone 中的通知弹出重定向

标签 ios iphone alert uilocalnotification

我有这个正常的通知警报代码:

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

这对我来说效果很好,但是当我点击“详细信息”时,我希望它被重定向到特定页面。相反,这只会重定向到应用程序的主页,我必须点击整个应用程序一直到提醒部分才能查看它。我不确定如何解决它。帮帮我。

谢谢。

最佳答案

您的应用程序委托(delegate)方法 application:didFinishLaunchingWithOptions: 将使用通知负载调用。 Local and Push Notification Programming Guide 中都有详细记录.

关于ios - iPhone 中的通知弹出重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7305598/

相关文章:

ios - 更改 SCNText 上的字符串值不会产生任何变化

ios - XCode IBAction 和 IBOutlets 错误

ios - 如何从 superview 获取所有元素(如 : UiLabel, UITextfield)并设置标签文本颜色和文本字段占位符颜色

iphone - 关闭 UIAlertView

ios - 使用类中结构的函数

ios - 在 Alamofire 4.0、iOS 10 和 Swift 3 中使用 Google Places API

javascript - 在 ajax success() 函数中创建时,Bootstrap 警报刷新并消失

alert - 如何在 Cypress 确认窗口中单击“接受”

iphone - 通过 UIPasteBoard 在短信中粘贴图像

iphone - 以编程方式在表格单元格中添加 UISegmentedControl 并具有清晰的背景