[英]iOS swift parse push notification
func singUp() {
var user = PFUser()
if ((self.userName.text != "") && (self.password.text != "") && (self.email.text != "") && (self.email.text == self.reenterEmail.text) && (self.gender != "")){
user.username = "\(userName.text.lowercaseString)"
self.userName.resignFirstResponder()
user.password = "\(password.text.lowercaseString)"
user.email = "\(email.text.lowercaseString)"
user["gender"] = "\(self.gender)"
user.signUpInBackgroundWithBlock {
(succeeded: Bool, error: NSError?) -> Void in
if let error = error {
let errorString = error.userInfo?["error"] as? NSString
self.errorAlert("\(errorString)")
} else {
// Hooray! Let them use the app now.
let message = "We have sent you a link on your email to verify Your account"
let okText = "Ok"
let alert = UIAlertController(title: "Signin Up Completed", message: message, preferredStyle: UIAlertControllerStyle.Alert)
let okayButton = UIAlertAction(title: okText, style: UIAlertActionStyle.Cancel, handler: { action in self.performSegueWithIdentifier("ShowSignInPage", sender: self)})
alert.addAction(okayButton)
self.presentViewController(alert, animated: true, completion: nil)
let installation = PFInstallation.currentInstallation()
installation["user"] = self.userName.text.lowercaseString
installation.saveInBackground()
}
}
我在安装类中遇到问题,其中用户信息未保存在此类中。 我收到此错误:
[Error]: object not found for update (Code: 101, Version: 1.7.5)
我认为您的问题在这一行:
if let error = error
您应该将其更改为:
if error != nil {}
就是这样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.