AppDelegate Touch3D Xcode - TabBar

AppDelegate Touch3D Xcode - TabBar

我第一次尝试在 xcode 7.3.1 和 swift 2 中实现 3D Touch。我在 info.plist 中插入了信息,直到这里工作,正如您从代码中看到的那样打开视图工作,问题是我没有查看 TabBar ...所以我决定改变一切,打开选项卡控制器,然后从那里输入 selectindex = 2 的部分,但不知道该怎么做... select index 函数 AppDelegate 可以工作,有人可以帮助我吗?

这是我在 AppDelegate 中管理 3D Touch 的代码

func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: Bool -> Void) {
        //questo codice verrà eseguito ogni volta che le Quick Actions verranno eseguite
        if (shortcutItem.type == "com.tuu.openSearch") {
          //section search THIS WORK without TabBar!!
            let viewcontroller = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("searchID")
            dispatch_async(dispatch_get_main_queue(), {
                self.window!.rootViewController?.presentViewController(viewcontroller, animated: false, completion: nil)
            })

        }
        if (shortcutItem.type == "com.tuu.openFavorite"){
            //section tabbar favorite, self.tabBarcontroller.selectedIndex = 2 not work!!
            let viewcontroller = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("favoritesID")
            viewcontroller.tabBarController?.selectedIndex = 2
            dispatch_async(dispatch_get_main_queue(), {
                self.window!.rootViewController?.presentViewController(viewcontroller, animated: false, completion: nil)

            })
        }
    }

已解决

if (shortcutItem.type == "com.tuu.openFavorite"){
            let tabBarController = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("favoritesID") as! UITabBarController
            tabBarController.selectedIndex = 2
            self.window?.rootViewController = tabBarController

        }