Swift - 解析 "Signing Up"错误

标签 swift parse-platform

var user = PFUser()
    user.username = username.text
    user.password = password.text

    user.signUpInBackgroundWithBlock {
        (succeeded: Bool!, signupError: NSError!) -> Void in

        self.activityIndicator.stopAnimating()
            UIApplication.sharedApplication().endIgnoringInteractionEvents()

            if signupError == nil  {
                // Hooray! Let them use the app now.

                println("signed up")

我在 user.signUpInBackgroundWithBlock {

处遇到错误

它说:

Function signature (Bool!, NSError!) -> is not compatible with expected type @obj_block (Bool, NSError!) - > Void

此代码来自教程视频。 Parse 当前的“Signing Up”代码看起来与这段代码不同

最佳答案

succeeded 应该是 bool 值而不是可选值。像这样删除感叹号:

(成功:Bool,注册错误:NSError!)

关于Swift - 解析 "Signing Up"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29994124/

相关文章:

ios - 在 Swift 中使用 Apple 的可达性类

arrays - 如何在多个数组的索引处保存多个元素?

ios - 用云代码解析查询Session类

ios - AudioKit "disconnected state"与链中节点的创建顺序相关的崩溃

javascript - 使用 Handlebars 显示来自 parse.com 的 json 响应

ios - 解析推送通知:“无效 token :用户可能已卸载了该应用程序”

database - Parse.com 数据库查询浏览器

ios - RestKit 重新上线时自动 POST/PUT

swift - 使用 api 调用发送 JSON 数组并存储在数据库中

ios - 将 ImageView 放在导航栏上