Why does my Parse Query succeed in AppDelegate, bu

2019-08-30 00:08发布

For some reason, my Parse query succeeds, and returns objects, in my AppDelegate.Swift file. However, when I make the same call in viewDidLoad of the initial view controller, it fails.

Has anyone had a similar issue?

Thanks!

Here is my query:

let query = PFQuery(className: "Houses")
    query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
        if error == nil {
            print("Succeeded")
            print(objects!.count)
        } else {
            print(error?.description)
        }
    }

1条回答
放荡不羁爱自由
2楼-- · 2019-08-30 00:26

SOLVED: Thanks to @Mo Nazemi in comments.

Parse was not initialized before the query call was made in viewDidLoad of root view controller.

查看更多
登录 后发表回答