Closed benpackard closed 2 years ago
It seems that this only happens if Parse is initialized using initialize(with: config)
, which I believe is the recommended approach.
If I use Parse.setApplicationId
and Parse.setServer
instead, the values of the sharing properties are maintained correctly. This isn't a viable solution though, since I don't use a client key which setApplicationId
requires. I also built some nice environment switching based on ParseClientConfiguration
that I wouldn't like to lose.
Perhaps there is a bug in initialize(with: config)
that resets the values of applicationGroupIdentifierForDataSharing
and containingApplicationBundleIdentifierForDataSharing
.
Not a bug. Just a difference in how to configure the environment. The correct solution if using a ParseClientConfiguration
is:
ParseClientConfiguration { config in
config.server = self.serverURL
config.applicationId = self.applicationID
config.applicationGroupIdentifier = "group.com.company.product"
config.containingApplicationBundleIdentifier = "com.company.product" // only do this one from the extension
}
New Issue Checklist
Issue Description
To access shared state (for example
PFUser.current()
) in an extension, I have enabled Keychain Sharing and App Groups capabilities as per the guide. The next step is to set those values in each target just prior to initializing Parse. For example, in my extension:I couldn't get this to work, so I started debugging and quickly found that after initializing Parse, the following properties were empty strings:
When accessed from either the main app,
applicationGroupIdentifierForDataSharing
andcontainingApplicationBundleIdentifierForDataSharing
are empty.Steps to reproduce
Create an app extension and configure the project per the guide, including setting
Parse.enableDataSharing(withApplicationGroupIdentifier: , containingApplication: )
. Initialize Parse usinginitializeWithConfiguration
. For example:Actual Outcome
Parse.applicationGroupIdentifierForDataSharing()
andParse.containingApplicationBundleIdentifierForDataSharing()
are empty when logged.Expected Outcome
Parse.applicationGroupIdentifierForDataSharing()
andParse.containingApplicationBundleIdentifierForDataSharing()
should return the values set prior to Parse initialization.Environment
Sorry, not sure what this is asking for.
Client
1.19.2
Server
4.2.0
Heroku
Database
MongoDB
MongoDB Atlas
Logs