1

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 saveAlls 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
                        [.....]
                    })
7
  • Your voteObject also gets saved. Are you sure the count doesn't include that too? Commented Dec 12, 2014 at 2:53
  • @rickerbh believe it includes that. Logically, wouldn't it be one save for the voteObject, and one save for the two objects in the saveAll? Commented Dec 12, 2014 at 2:55
  • Yes, you're right - silly me. I just tried the same thing. Created 5 PFObjects, saved them with a saveAllInBackground and watched network traffic. There is definitely only 1 network request being made. However, my analytics API hit increased by 5. I guess it's quicker/more reliable from a client perspective as a single request has to go, but it appears you don't actually save API hits. What a scam! Commented Dec 12, 2014 at 3:13
  • If you look right at the end of the REST operations API documentation with their batch command (which is how I'd assume saveAll is implemented under the hood) it states "Note that N requests sent in a batch will still count toward your request limit as N requests." Commented Dec 12, 2014 at 3:21
  • @rickerbh Very strange. I am curious (if what you say is true) why most people are saying it only takes one request. Could perhaps the saveAll method (in theory) have some special tag that differs from a batch that tells Parse to only count it as one request? If only we had Hector Ramos here to save the day... Commented Dec 12, 2014 at 3:27

1 Answer 1

0

The saveAll method no longer counts as 1 API call. It now counts as 1 API call for EACH object being saved. See here for more info: stackoverflow.com/q/25690439/3344977

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.