Can't enable Parse Local Datastore

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.'

Upvotes: 0

Views: 2505

Answers (3)

Tina
Tina

Reputation: 1

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
}

Upvotes: 0

abanet
abanet

Reputation: 1387

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.

Upvotes: 0

J.J.
J.J.

Reputation: 1118

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.

Upvotes: 6

Related Questions