volx757
volx757

Reputation: 163

Parse query returning nothing from findObjectsInBackgroundWithBlock

EDIT: I changed the question title. and I changed the function to findObjectsInBackgroundWithBlock -

override func viewDidAppear(animated: Bool) {
    let predicate = NSPredicate(format: "username != '"+userName+"'")
    var query = PFQuery(className: "_User", predicate: predicate)
    var objects = query.findObjectsInBackgroundWithBlock({
        (objects:[AnyObject]!, error: NSError!) in
        if(error == nil){

            for object in objects {
                self.resultsUsernameArray.append(object.username)
                self.resultsProfileNameArray.append(object.email)
                self.resultsImageFiles.append(object["photo"] as PFFile)

                self.resultsTable.reloadData()
            }
        }else{
            println("error in quert execution \(error)")
        }
    })
}

There is one warning [variable 'objects' inferred to have type 'Void', which may be unexpected], and the code still returns nothing. I have 3 users in my Parse account for this app.

There's no error anymore, I guess that's good at least?



I'm new to xcode, and can't find how to search for this function. I'm having the same issue with Parse that others have had. My find query worked twice, and now (with no changes to the code) it stops returning anything. I want to do as suggested and 'Break on warnBlockingOperationOnMainThread() to debug,' but the only project search feature I can find (right clicking the project and doing 'Find in selected groups') doesn't bring anything up.

So, how do I find this function to add a breakpoint? Or, better yet, why did this query stop working?

override func viewDidAppear(animated: Bool) {
    let predicate = NSPredicate(format: "username != '"+userName+"'")
    var query = PFQuery(className: "_User", predicate: predicate)
    var objects = query.findObjects()

    for object in objects {
        self.resultsUsernameArray.append(object.username)
        self.resultsProfileNameArray.append(object.email)
        self.resultsImageFiles.append(object["photo"] as PFFile)

        self.resultsTable.reloadData()
    }
}

Thanks!

Upvotes: 0

Views: 353

Answers (1)

kviksilver
kviksilver

Reputation: 3854

From: https://developer.apple.com/library/mac/recipes/xcode_help-breakpoint_navigator/articles/adding_a_symbolic_breakpoint.html

In the bottom-left corner of the breakpoint navigator, click the Add button.

Choose Add Symbolic Breakpoint.

Enter the symbol name in the Symbol field.

If the symbol is declared in more than one library, enter the name of the appropriate library in the Module field.

To specify that program execution be suspended only if an expression evaluates to true, enter the expression in the Condition field.

Click Done.

Upvotes: 1

Related Questions