xcode - Swift + 解析注销错误

标签 xcode swift parse-platform xcode6

在按下注销按钮时尝试终止用户 session 时出现错误。有人知道我哪里出错了吗?提前致谢 这是代码

@IBAction func logoutButtonTapped(sender: AnyObject) {

    NSUserDefaults.standardUserDefaults().setBool(false, forKey: "isUserLoggedIn");
    NSUserDefaults.standardUserDefaults().synchronize();

    PFUser.logOutInBackgroundWithBlock({ (error:NSError!) -> Void in
        self.performSegueWithIdentifier("loginView", sender: self);

    })

错误:“无法使用类型为‘((NSError) -> Void)’的参数列表调用‘logOutInBackgroundWithBlock’”

最佳答案

从参数中删除类型说明符 NSError!

PFUser.logOutInBackgroundWithBlock({(error) -> Void in
  self.performSegueWithIdentifier("loginView", sender: self);
})

关于xcode - Swift + 解析注销错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32498220/

相关文章:

ios - 快速计算当前连胜

ios - 当应用程序的设置不存在时如何打开它们

swift - 在 Swift 中调用 NSException.raise()

java - 无法删除 ParseObject

iphone - ios:如何模仿Android viewflipper control/multiview tree of decision?

ios - 当 ctrl + 拖动时,Xcode 不显示完整的 segues 列表

swift - 空值评估为 TRUE

javascript - parse.com 类中的指针中的查询指针

xcode - 手动编译 Metal 着色器

ios - 如何将 Unity 集成到 native iOS 应用程序中?