Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用Swift中的解析创建具有配置文件图片的用户_Ios_Swift_Parse Platform_Pfuser - Fatal编程技术网

Ios 使用Swift中的解析创建具有配置文件图片的用户

Ios 使用Swift中的解析创建具有配置文件图片的用户,ios,swift,parse-platform,pfuser,Ios,Swift,Parse Platform,Pfuser,如何使用Parse创建注册页面,让用户在Swift中输入自己的个人资料图片。请检查下面的代码,使用Parse.com将照片字段添加到用户表中 var user = PFUser() let imageData = UIImageJPEGRepresentation(userDetails.getPhoto(), 0.05) let imageFile = PFFile(name:"image.jpg", data:imageData) imageFile.save()

如何使用Parse创建注册页面,让用户在Swift中输入自己的个人资料图片。

请检查下面的代码,使用Parse.com将照片字段添加到用户表中

 var user = PFUser()

    let imageData = UIImageJPEGRepresentation(userDetails.getPhoto(), 0.05)
    let imageFile = PFFile(name:"image.jpg", data:imageData)
    imageFile.save()

    user.username = usrEntered
    user.password = pwdEntered
    user.email = emlEntered

    user.setObject(imageFile, forKey: "photo")

    user.signUpInBackgroundWithBlock {
        (succeeded: Bool!, error: NSError!) -> Void in
            if error == nil {
               // Hooray! Let them use the app now.
               self.messageLabel.text = "User Signed Up";
            } else {
                // Show the errorString somewhere and let the user try again.
            }
    }