Ios 如何获取所选UILocalNotification信息

Ios 如何获取所选UILocalNotification信息,ios,objective-c,uilocalnotification,Ios,Objective C,Uilocalnotification,我创建了一个iphone应用程序,其中我使用UILocalNotifications。它很好用。但是现在,当我点击通知时,我想得到我点击的通知的行号。可能吗 UILocalNotification *localNotif = [[UILocalNotification alloc] init]; localNotif.fireDate = itemDate; localNotif.timeZone = [NSTimeZone defaultTimeZone]; // Notification

我创建了一个iphone应用程序,其中我使用UILocalNotifications。它很好用。但是现在,当我点击通知时,我想得到我点击的通知的行号。可能吗

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = itemDate;
localNotif.timeZone = [NSTimeZone defaultTimeZone];

// Notification details
localNotif.alertBody = [eventText text];
// Set the action button
localNotif.alertAction = @"View";

localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;

// Specify custom data for the notification
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"someValue" forKey:@"someKey"];
localNotif.userInfo = infoDict;

// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];

提前感谢。

当用户触发本地通知以打开您的应用程序时,您将收到应用程序:didReceiveLocalNotification:或应用程序:didFinishLaunchingWithOptions:with UIApplicationLaunchActionSlocalNotificationKey的回调

收到回调后,可以获取关联的UILocalNotification并访问其属性。通常,您对用户信息和添加到其中的密钥感兴趣。你可以添加任何你想要的


我通常会远离索引数字,因为它们可能会随着你所做的事情而变化。取而代之的是,考虑给每个通知一个唯一的标识,如GUID,并使用它来查找在应用程序中保持的任何相关数据。

通知没有行号。更详细地解释您正在做什么,并显示发布通知的代码,以及您希望表视图使用的行号。我只想要我选择的通知索引号。显示您的代码,您的问题和注释没有意义。您是在谈论NSNotification、IBAction还是其他什么?我现在不知道。我更新了我的问题