使用 Parse-Server 时,Parse LocalDataStore 不起作用 - 'Method requires Pinning enabled.'

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

我最近开始使用 Parse-Server 并迁移了我的 Parse 应用程序,现在当我尝试使用 Parse Local DataStore 时,我收到以下错误:

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

这是产生错误的代码:

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

如果我通过调用初始化解析旧方法:

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

然后 Local DataStore 工作正常,但是如果我初始化 Parse 新方式然后我得到错误:

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

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

 }]];

我在 Parse 初始化之前调用 [Parse enableLocalDatastore];,我也试过在之后调用它以确保确定。

感谢您的宝贵时间,希望您能提供帮助

我打开了一个issue on GitHub,那里有人为我解决了这个问题:

"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;