Can't enable Parse Local Datastore

廉价感情. 提交于 2019-12-25 01:13:53

问题


I'm trying enable the Parse Local Datastore. In the Parse Docs, they said to put the code enableLocalDatastore before setApplicationId:clientKey:, but this throws an exception:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You have to call setApplicationId:clientKey: on Parse to configure Parse.'


回答1:


v1.6.0

Place the code for enableLocalDatastore after setting applicationId and clientKey. It looks like it was simply a mistake in their documentation.

v1.6.1+

Place the code for enableLocalDatastore before setting applicationId and clientKey.




回答2:


Just be sure you don't have any cachePolicy set in your code. In my case I had

query.cachePolicy = kPFCachePolicyNetworkElseCache

There is not need of a cache now you have your data in a local database.




回答3:


I was having the same error.

I commented this line" // query.cachePolicy = PFCachePolicy.CacheElseNetwork" and it works.

override func queryForTable() -> PFQuery {
let query: PFQuery = PFQuery(className: self.parseClassName!)
if(objects?.count == 0){
   //query.cachePolicy = PFCachePolicy.CacheElseNetwork
    }
    query.orderByAscending(Column Name")
    return query
}


来源:https://stackoverflow.com/questions/27464690/cant-enable-parse-local-datastore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!