signUpInBackgroundWithBlock不再起作用

signUpInBackgroundWithBlock不再起作用

本文介绍了SWIFT +解析signUpInBackgroundWithBlock不再起作用:Xcode 6.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自parse.com的最新解析代码进行user.signupInBackgroundWithBlock

I'm using the latest parse code from the parse.com for user.signupInBackgroundWithBlock

user.signUpInBackgroundWithBlock {
            (succeeded: Bool?, error: NSError?) -> Void in
            if let error = error {
                let errorString = error.userInfo?["error"] as? NSString
               self.showAlertWithText(message: "\(error)")
            } else {
                self.performSegueWithIdentifier("createNewUserAndGoToDashboard", sender: self)
            }

我刚刚升级到x-code 6.3.1,它不再起作用.这是直接从Parse.com复制的,但是在user.signUp行上出现错误:

I just upgraded to x-code 6.3.1 and it no longer works. This is copied directly from Parse.com, but I'm getting an error on the user.signUp line:

1.0/SIgnUpViewController.swift:48:46:函数签名'(Bool?, NSError?) -> Void'与预期类型不兼容

1.0/SIgnUpViewController.swift:48:46: Function signature '(Bool?, NSError?) -> Void' is not compatible with expected type

'@objc_block (Bool, NSError!) -> Void'

有什么提示吗?

推荐答案

您是否尝试过不带?"在布尔之后

have you tried it without the "?" after the Bool

user.signUpInBackgroundWithBlock {
            (succeeded: Bool, error: NSError?) -> Void in
            if let error = error {
                let errorString = error.userInfo?["error"] as? NSString
                self.showAlertWithText(message: "\(error)")
            } else {
                self.performSegueWithIdentifier("createNewUserAndGoToDashboard", sender: self) }

这篇关于SWIFT +解析signUpInBackgroundWithBlock不再起作用:Xcode 6.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 06:27