From what I can tell from the Parse docs and Stack Overflow, the PFObject.saveAllInBackground
will only require 1 API request to save all the objects.
My method saves an object, then comes back and saveAll
s 2 more objects. This seems like it should take only 2 API requests, however Parse Analytics is telling me that it is taking 3.
Any guesses?
Here is the code:
// Create new Vote object
var voteObject = PFObject(className: "Votes")
[.....]
voteObject.saveInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
if (succeeded == true){
// Add relation for postObject
self.postObject.relationForKey("UserVotes").addObject(voteObject)
// Add relation for user object
PFUser.currentUser().relationForKey("userVotes").addObject(voteObject)
PFObject.saveAllInBackground([self.postObject, PFUser.currentUser()], block: {
(succeeded: Bool!, error: NSError!) -> Void in
[.....]
})