Parse-server: Share Extension - [PFUser currentUser] is nil

Created on 22 Feb 2016  路  2Comments  路  Source: parse-community/parse-server

Hi,

I've tested the previously working Share Extension (using Parse platform) after I migrated to Parse-server. The main/container app is working fine with queries and is still configured as follows:
[Parse enableDataSharingWithApplicationGroupIdentifier:AppGroupId];
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock..

So on my share extension I'm still using the same initialization as well except [Parse setApplicationId.. which is changed to Parse initializeWithConfiguration,

[Parse enableDataSharingWithApplicationGroupIdentifier:AppGroupId containingApplication:AppGroupId]; [Parse enableLocalDatastore];
before I set the Parse initializeWithConfiguration...

On the share extension, the [PFUser currentUser] is always nil..

Kindly advise if there are some tweaks need to be done.. Thanks in advance..

Most helpful comment

Hey @seecahkhing, initializeWithConfiguration: changes everything :stuck_out_tongue:
Now to enable data sharing - you would need to do something like this:

[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
  configuration.applicationId = ...;
  configuration.clientKey = ...;
  configuration.localDatastoreEnabled = YES;
  configuration.applicationGroupIdentifier = AppGroupId;
  configuration.containingApplicationBundleIdentifier = AppGroupId; // This goes only in extension
 }];

Which means that any configuration applied directly via Parse class if you use initializeWithConfiguration: is ignored and is superseded by the configuration provided in an object.
Hope this helps, feel free to reopen this issue if it doesn't.

All 2 comments

Hey @seecahkhing, initializeWithConfiguration: changes everything :stuck_out_tongue:
Now to enable data sharing - you would need to do something like this:

[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
  configuration.applicationId = ...;
  configuration.clientKey = ...;
  configuration.localDatastoreEnabled = YES;
  configuration.applicationGroupIdentifier = AppGroupId;
  configuration.containingApplicationBundleIdentifier = AppGroupId; // This goes only in extension
 }];

Which means that any configuration applied directly via Parse class if you use initializeWithConfiguration: is ignored and is superseded by the configuration provided in an object.
Hope this helps, feel free to reopen this issue if it doesn't.

@nlutsenko
Can you please explain how to import parse library to share extension?

Was this page helpful?
0 / 5 - 0 ratings