xcode - 解析查询从 findObjectsInBackgroundWithBlock 不返回任何内容

标签 xcode swift parse-platform

编辑: 我更改了问题标题。 我将函数更改为 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)")
        }
    })
}

有一个警告[变量“对象”推断为“Void”类型,这可能是意外的],并且代码仍然没有返回任何内容。我的 Parse 帐户中有 3 个用户使用此应用程序。

不再有错误了,我想这至少很好?

<小时/> <小时/>

我是 xcode 新手,无法找到如何搜索此函数。我在 Parse 上遇到了和其他人遇到的同样的问题。我的查找查询工作了两次,现在(代码没有更改)它停止返回任何内容。我想按照建议进行操作并“中断 warnBlockingOperationOnMainThread() 进行调试”,但我能找到的唯一项目搜索功能(右键单击项目并执行“在选定组中查找”)不会显示任何内容。

那么,如何找到这个函数来添加断点呢?或者,更好的是,为什么这个查询停止工作?

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()
    }
}

谢谢!

最佳答案

来自: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.

关于xcode - 解析查询从 findObjectsInBackgroundWithBlock 不返回任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28750889/

相关文章:

ios - swift - 检索 objectId 字段导致 fatal error

ios - 将 Ruby bundler gems 作为 Xcode 构建脚本运行

xcode - 案例和快速切换

ios - 无法让 Stripe 示例应用程序将测试付款发送到 Stripe 帐户

ios - 启动和停止事件指示器 swift3

ios - 如何使用 for 循环将字符串分配给 NSDictionary?

swift - 如何仅在另一个函数完成时才调用一个函数? (Swift 并从 Parse 中检索)

objective-c - bundle ID中的$ product是什么

ios - xcode 在没有设备的情况下进行临时构建

ios - 如何识别触发单个 Storyboard转场的众多按钮中的哪个按钮