Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.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
Swift 如果未通过身份验证,则重定向到情节提要_Swift_Storyboard_Facebook Login - Fatal编程技术网

Swift 如果未通过身份验证,则重定向到情节提要

Swift 如果未通过身份验证,则重定向到情节提要,swift,storyboard,facebook-login,Swift,Storyboard,Facebook Login,我是iOS新手,但熟悉Android,目前正在使用开源VLC媒体播放器代码 我想做的是,如果用户打开应用程序并且没有通过Facebook登录,则向登录屏幕添加重定向 if AccessToken.current != nil { // basic usage self.view.makeToast("Logged In") }else { // basic usage self.vi

我是iOS新手,但熟悉Android,目前正在使用开源VLC媒体播放器代码

我想做的是,如果用户打开应用程序并且没有通过Facebook登录,则向登录屏幕添加重定向

if AccessToken.current != nil {
            // basic usage
            self.view.makeToast("Logged In")

        }else {
            // basic usage
            self.view.makeToast("Logged Out")

          // Add redirect to login page logic here

        }
如何创建登录页面并重定向


我创建了一个名为LoginScreen.storyboard的故事板,并添加了一些按钮,如果用户未登录,我想重定向到它。

首先通过单击ViewController->Identity Inspector,向ViewController提供您已从Interface Builder创建的故事板ID。为VC分配ID后,在代码中:

if AccessToken.current != nil {
        // TODO
        self.view.makeToast("Logged In")

    }else {
        self.view.makeToast("Logged Out")

      let sb = UIStoryboard(name: "LoginScreen", bundle: nil) // current Storyboard
      let loginVC = sb.instantiateViewController(withIdentifier: "yourIdentifierName") // instantiate Login page
      self.present(loginVC, animated: true, completion: nil) // present instantiated ViewController

    }

我不确定在哪里单击视图控制器。当您单击序列图像板文件时,它是否在GUI中?@ChrisM Open main.storyboard从左侧导航选项卡,您将在视图控制器上方看到一个白色条。单击它,然后在右菜单顶部,您将能够导航到Identity Inspector。我没有main.storyboard文件,这就是我无法阅读教程的原因。我使用@ChrisM选择你创建的一个,据我所知,LoginScreen.storyboard。然后按照上面的步骤操作。我在编辑器右侧找到了故事板ID部分,并输入了“LoginsScreenFacebook”