Ios 打开本地通知将打开特定视图
当用户单击通知时,我希望应用程序打开到我的选项卡栏控制器上的第三个选项卡。我可以得到开火的通知,但不能打开正确的部分。在我的应用程序的DidFinishLaunching中,我有以下选项:Ios 打开本地通知将打开特定视图,ios,uitabbarcontroller,uilocalnotification,Ios,Uitabbarcontroller,Uilocalnotification,当用户单击通知时,我希望应用程序打开到我的选项卡栏控制器上的第三个选项卡。我可以得到开火的通知,但不能打开正确的部分。在我的应用程序的DidFinishLaunching中,我有以下选项: UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (localNotif) { tabBarControl
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;
}
但是,单击通知只会像正常情况一样打开第一个选项卡。。第三个选项卡也是tabBarController.selectedIndex=2
,因为计数从0开始