Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 迅速发展的维吾尔-巴布托主义是隐藏的,但起作用_Ios_Swift_Uinavigationcontroller_Uitabbarcontroller_Uibarbuttonitem - Fatal编程技术网

Ios 迅速发展的维吾尔-巴布托主义是隐藏的,但起作用

Ios 迅速发展的维吾尔-巴布托主义是隐藏的,但起作用,ios,swift,uinavigationcontroller,uitabbarcontroller,uibarbuttonitem,Ios,Swift,Uinavigationcontroller,Uitabbarcontroller,Uibarbuttonitem,我对一个维吾尔人有意见。如果我使用ViewController保护我的应用程序,通过触摸ID对用户进行身份验证,则导航控制器中的UIBarButtonItem将隐藏 AppDelegate中的代码: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

我对一个维吾尔人有意见。如果我使用ViewController保护我的应用程序,通过触摸ID对用户进行身份验证,则导航控制器中的UIBarButtonItem将隐藏

AppDelegate中的代码:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let touchIDonoff = UserDefaults.standard.object(forKey: "touchIDActive") as! Bool!

    if touchIDonoff == true {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let loginVC = storyboard.instantiateViewController(withIdentifier: "TouchIDViewController") as! TouchIDViewController
        self.window?.rootViewController = loginVC

    }
    return true

}
ViewController中TouchID请求的代码:

override func viewDidLoad() {
    super.viewDidLoad()
    DispatchQueue.main.async {
        self.touchIDrequest()
    }

@IBAction func buttonTouchID(_ sender: AnyObject) {
    touchIDabfrage()
}



func touchIDrequest() {
    let authenticationContext = LAContext()
    var error: NSError?


    if authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
        authenticationContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Please authenticate", reply: { (success: Bool, error: Error?) in

            if success {
                self.navigatetoAuthenticatedVC()
            } else {
                if let evaluateError = error as? NSError {
                    print(error)
                    /*let message = self.errorMessageForLAErrorCode(errorCode: evaluateError.code)
                    self.showAlertViewAfterEvaluatingPolicyWithMessage(message: message)
                    */
                }
            }


        })
    } else {
        showAlertViewForNoBiometrics()
        return
    }
}

func navigatetoAuthenticatedVC() {

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let tabBarController = storyboard.instantiateViewController(withIdentifier: "LoggedInVC") as! UITabBarController
    let appDelegate = UIApplication.shared.delegate as! AppDelegate

    DispatchQueue.main.async {
    appDelegate.window?.rootViewController = tabBarController
    }

}
如果我点击隐藏的UIBarButtonItem,它会工作并将我带到下一个ViewController,当我返回时,UIBarButtonItem是可见的

我做错了什么?需要帮忙吗

致意


你能在按钮上显示属性检查器吗?我更新了帖子。这里的想法是你必须将
isUserInteractionEnabled
属性设置为
false
,但它的工作原理非常奇怪,我无法让它工作。如果你愿意,我可以建议你一个解决方法。你需要禁用bar按钮项。如果你想隐藏它,可以使用nil bar按钮