小编Pau*_*yer的帖子

我该如何修复"Error Domain = NSCocoaErrorDomain Code = 3840"没有值."UserInfo = {NSDebugDescription = No value.}"

当我运行我的代码我得到这个错误,我不知道为什么.

错误域= NSCocoaErrorDomain代码= 3840"没有值." UserInfo = {NSDebugDescription =无值.}

我在互联网上找了它,但我找不到东西.

这是我的代码:

 let myUrl = NSURL(string: "http://foodhelper.club/registerUser.php");
    let request = NSMutableURLRequest(URL:myUrl!);
    request.HTTPMethod = "POST";

    let postString = "userEmail=\(userEmail!)&userFirstName=\(userFirstName!)&userLastName=\(userLastName!)&userPassword=\(userPassword!)";

    request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding);

    NSURLSession.sharedSession().dataTaskWithRequest(request, completionHandler: { (data:NSData?, response:NSURLResponse?, error:NSError?) -> Void in

        dispatch_async(dispatch_get_main_queue())
        {



            if error != nil {
                self.alertMessage(error!.localizedDescription)
                print("fail")
                return
            }

            do {
            let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers) as? NSDictionary
                print ("1")
              if let parseJSON = json {

                    let userId = parseJSON["userId"] as? String
                    print ("2")
                    if( userId != nil) …
Run Code Online (Sandbox Code Playgroud)

database json http swift

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

database ×1

http ×1

json ×1

swift ×1