Swift if / else语句中的预期声明

时间:2016-08-02 16:37:58

标签: ios swift xcode

        if userData != nil {
        self.initUserInfo()

        self.retreiveOrderCount()
        self.retreiveWatchCount()
        self.retreiveFollowingCount()
    } else {
        UIApplication.sharedApplication().networkActivityIndicatorVisible = false

        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let controller = storyboard.instantiateViewControllerWithIdentifier("loginview")

        self.presentViewController(controller, animated: true, completion: nil)
    }
}

这是给我预期声明的代码块。

1 个答案:

答案 0 :(得分:0)

最后还有一个额外的支架。如下图所示取下支架:

if userData != nil {
        self.initUserInfo()

        self.retreiveOrderCount()
        self.retreiveWatchCount()
        self.retreiveFollowingCount()
    } else {
        UIApplication.sharedApplication().networkActivityIndicatorVisible = false

        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let controller = storyboard.instantiateViewControllerWithIdentifier("loginview")

        self.presentViewController(controller, animated: true, completion: nil)
    }