iosparse-platformlocal-datastoreparse-server

Parse LocalDataStore does not work when using Parse-Server - 'Method requires Pinning enabled.'


I have recently started using Parse-Server and have migrated my Parse App, now when I try to use Parse Local DataStore I receive the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Method requires Pinning enabled.'

This is the code that produces the error:

PFQuery *query = [PFQuery queryWithClassName:@"MY_CLASS_NAME"];
[query fromPinWithName:@"PIN_NAME"];
[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {

If I initialise parse the old way by calling:

[Parse setApplicationId:@"APP_ID" clientKey:@"KEY"];

Then Local DataStore works fine, but if I initialise Parse the new way then I get the error:

[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {

 configuration.applicationId = @"APP_ID";
 configuration.clientKey = @"KEY";
 configuration.server = @"SERVER";

 }]];

I am calling [Parse enableLocalDatastore]; before Parse is being initialised, I've tried calling it after as well just to be sure.

Thanks for your time, hope you can help


Solution

  • I opened an issue on GitHub and someone there solved the problem for me:

    "if you are using configuration with initialization - you need to enable a local datastore slightly differently. Add the following line into the configuration block to enable it:"

    configuration.localDatastoreEnabled = YES;