F. Bar F. Bar - 4 months ago 36
Swift Question

PFQuery finding all objects within a class

This is a really basic question but I really don't understand why my code keeps looping through the query.

I have a parse server hosting by Heroku and a table view controller and I'm trying to create a query to return n number of rows (depending on how many rows on my table)

Here is the code I have made:

let query = PFQuery(className: institutionTitle)
query.findObjectsInBackground { (objects, error) in
if error != nil {
print("There has been an error")
} else {
if let objects = objects {
for object in objects {

is a string which matches with my
on Parse and
is an array of
used to store the information from entries pulled from the table.

I have 1 row on my table but when I run this code and print
, for some reason it keeps incremented the number of rows in the array and I have no idea why.

If someone could help me it would be much appreciated.



If the line print(postGrabber.count) is called multiple times, the problem doesn't come from the query but from something higher in your code. If you don't find it copy paste your code here.