【发布时间】:2015-10-29 11:08:56
【问题描述】:
我已经搜索了很长时间,但没有任何结果适合我。我能够将用户的用户名、电子邮件、密码和示例位置上传到 Parse 上的“用户”类。但我需要将图像上传到 Parse 以获取用户的占位符个人资料图像。我在 Xcode (ProfileImagePlaceHolder.png) 的资产中有图像
如何将此图片上传到 Parse 作为用户的个人资料图片?
@IBAction func registerTapped(sender: UIButton)
{
print("Register Page - Register Tapped")
if txtEmailAddress.text == "" || txtPassword.text == "" || txtPasswordConfirmation.text == ""
{
print("Registration fields are not complete.")
REGISTER_INCOMPLETE_FIELD.show()
}
else if txtPassword.text != txtPasswordConfirmation.text
{
print("Password Confirmation does not match with Password.")
PASSWORD_CONFIRMATION_DOESNT_MATCH.show()
}
else
{
let user = PFUser()
user.username = txtEmailAddress.text
user.password = txtPassword.text
user.email = txtEmailAddress.text
user["location"] = PFGeoPoint(latitude: 41, longitude: 29)
user.signUpInBackgroundWithBlock {
(succeeded: Bool, error: NSError?) -> Void in
if error != nil {
print("There is a problem.")
SOMETHING_IS_WRONG.show()
} else {
// Hooray! Let them use the app now.
print("Successfully registered.")
SUCCESS_REGISTER.show()
self.performSegueWithIdentifier(SEGUE_REGISTERED, sender: self)
//
}
}
}
}
【问题讨论】:
-
你检查我下面的答案了吗?
标签: ios swift parse-platform swift2