当用户点击通知时,我希望应用打开我的标签栏控制器上的第三个标签。我可以获得通知,但不能打开正确的部分。在我的应用程序的didFinishLaunchingWithOptions我有:
UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif) {
tabBarController.selectedIndex = 3;
}
然后在AppDelegate中,我有:
- (void)application:(UIApplication *)application
didReceiveLocalNotification:(UILocalNotification *)notification {
application.applicationIconBadgeNumber = 0;
NSString *reminderText = [notification.userInfo
objectForKey:kRemindMeNotificationDataKey];
[viewController showReminder:reminderText];
tabBarController.selectedIndex = 3;
}
但是,点击通知只会像平常一样将其打开到第一个标签页。