1

我之前Parse.enableLocalDatastore()在我的应用程序委托中Parse.setApplicationId

然后我有var newPosts = PFObject(className: "Post")一个全局变量。

然后我想从我之前启用的 localDataStore 的“Post”表中获取 1,000 个最新对象,所以我这样做:

var getNewPosts = PFQuery(className: "Post")
getNewPosts.fromLocalDatastore()
getNewPosts.limit = 1000
getNewPosts.orderByDescending("createdAt")
getNewPosts.findObjectsInBackgroundWithBlock {
    (downloadedPosts, error) -> Void in
        if downloadedPosts != nil && error == nil {
            println(downloadedPosts) // I am getting table with no data
        }
    }

但我只得到空数据行。如果我注释掉getNewPosts.fromLocalDatastore()行结果很好。

我知道我错过了关键的固定步骤,但不确定 Parse 文档锄头以及在哪里实现它。你能帮忙吗?

4

1 回答 1

0

你没有得到任何数据......原因我是......

类名错误(类名区分大小写) 本地存储中没有数据

尝试 findObject: 方法和 pin: 方法的同步版本。

于 2015-06-18T18:20:04.177 回答