Closed
Description
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
Labels
No labels