问题
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:
SOLVED: Thanks to @Mo Nazemi in comments.
Parse was not initialized before the query call was made in viewDidLoad
of root view controller.
来源:https://stackoverflow.com/questions/33262099/why-does-my-parse-query-succeed-in-appdelegate-but-not-in-viewcontroller