Skip to content

fetchAllIfNeededInBackground error "Object not found on the server." #986

Closed
@acegreen

Description

@acegreen

I'm running into an issue where I present a view and try to execute fetchAllIfNeededInBackground on a few objects. The first time the function is called, I get the mentioned error. Subsequent calls yields results.

Important note to make. This pointers in the "recentSearches" array can be from two classes.

    func getUserRecentSearches() {

        guard let currentUser = PFUser.currentUser() else { return }

        if let currentUserRecentSearches = currentUser["recentSearches"] as? [PFObject] {

            PFObject.fetchAllIfNeededInBackground(currentUserRecentSearches) { (currentUserRecentSearches, error) in

                if let currentUserRecentSearches = currentUserRecentSearches as? [PFObject] {
                    self.recentSearches = currentUserRecentSearches
                    self.tableView.reloadData()
                }
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions