objective-cparse-platformparse-ios-sdk

Parse Server data not shared between app and today extension



I'm using a parse server for delivering news and calendar information to iOS and Android apps. (Therefore I don't need any user accounts.)
I followed the instructions on the parse site (https://docs.parseplatform.org/ios/guide/#enable-data-sharing) to enable data sharing but the data doesn't get shared. I have to download the information in the app and the today extension.

Here is the code I use to initialize the parse SDK:

+ (void)establishConnectionForExtension:(BOOL)extension {
    // enable app groups
    if (extension) [Parse enableDataSharingWithApplicationGroupIdentifier:@"group.de.company.app" containingApplication:@"de.company.app"];
    else [Parse enableDataSharingWithApplicationGroupIdentifier:@"group.de.company.app"];

    // initialize parse
    [Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration>  _Nonnull configuration) {
        configuration.applicationId = PARSE_ID;
        configuration.clientKey = PARSE_KEY;
        configuration.server = @"https://";
        configuration.localDatastoreEnabled = YES;
    }]];
}

Solution

  • I found the solution:

    + (void)establishConnectionForExtension:(BOOL)extension {
        [Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration>  _Nonnull configuration) {
            configuration.applicationGroupIdentifier = @"group.de.company.app";
            configuration.applicationId = PARSE_ID;
            configuration.clientKey = PARSE_KEY;
            configuration.localDatastoreEnabled = YES;
            configuration.server = @"https://";
            if (extension) configuration.containingApplicationBundleIdentifier = @"de.company.app";
        }]];
    }
    

    It would be great to find this in the official Parse documentation... (I needed three days to to get this working.)