I am trying to connect to my AWS server, but when I try to save an object there, Xcode cannot reach and trow me this error:
Optional(Error Domain=Parse Code=0 "unauthorized" UserInfo={error=unauthorized, NSLocalizedDescription=unauthorized, temporary=0})
Here's my code on appDelegate:
Parse.enableLocalDatastore()
let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "*******"
ParseMutableClientConfiguration.clientKey = "****************"
ParseMutableClientConfiguration.server = "http://ec2-3-22-186-169.us-east-2.compute.amazonaws.com/parse"
})
Parse.initialize(with: parseConfiguration)
testParseSave()
return true
}
func testParseSave() {
let testObject = PFObject(className: "MyTestObject")
testObject["foo"] = "bar"
testObject.saveInBackground { (success, error) -> Void in
if success {
print("El objeto se ha guardado en Parse correctamente.")
} else {
if error != nil {
print("is NOT nil:")
print (error as Any)
} else {
print("IS nil:")
print ("Error")
}
}
}
}
Thanks in advance!