Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing implementation for NSFileManager containerURLForSecurityApplicationGroupIdentifier #2295

Closed
ArnOmsft opened this issue Mar 22, 2017 · 2 comments
Assignees
Milestone

Comments

@ArnOmsft
Copy link
Member

It's used by alakoring to load/save game data and currently causes a crash.

@rajsesh
Copy link
Contributor

rajsesh commented Mar 23, 2017

It is not a matter of a missing API, application group identifiers are a platform feature. The closest approximation of this for UWPs is the publisher shared cache folder. It has several caveats:

See documentation Publisher Cache Folder

  • The cache itself can be cleared by the user, so it should not be the only place the user settings are saved.
  • There are no group collection concept - that is, all apps by the publisher have access to the shared cache. This itself is not a big limitation.

We should be able to implement the said API with these caveats. Also the app manifest needs to be updated. This may possibly be done automatically by vsimporter.

https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html

https://blogs.windows.com/buildingapps/2016/05/24/sharing-your-local-app-data/

@rajsesh rajsesh added the Task label Mar 23, 2017
@rajsesh rajsesh assigned aballway and unassigned rajsesh Mar 23, 2017
@rajsesh rajsesh added this to the 1704 milestone Mar 23, 2017
@rajsesh
Copy link
Contributor

rajsesh commented Mar 28, 2017

Also need samples - in the winobjc-samples repo that demo this.

aballway added a commit that referenced this issue Apr 4, 2017
The reference platform has a concept of an application-group entitlement which allows apps made by the same publisher to share folders and semaphores. The shared folders can be accessed through -[NSFileManager containerURLForSecurityApplicationGroupIdentifier:] which will return an NSURL pointing to the shared folder with the given name if one exists.

These folders are declared in an entitlements file separate from the main .pbxproj and info.plist where other settings are stored, and is pointed at by the value with key CODE_SIGN_ENTITLEMENTS in the PBXNativeTarget's Build Configurations.

Here, the shared folders are implemented using Windows' Publisher Cache Folders, which also allow files to be shared in designated folders between apps of the same publisher, but with the caveat that users can clear the data at any time so it should not be used as the sole storage for key data.

VSImporter has been modified to check if CODE_SIGN_ENTITLEMENTS exists, and if it does, read the file and look for com.apple.security.application-groups, which will contain an array of folder names which are to be shared. The reference platform specifies the format which folders must be named, but Publisher Cache Folders does not have such a restriction for names so any valid folder names will be taken and used.

-[NSFileManager containerURLForSecurityApplicationGroupIdentifier:] is implemented by checking if a Publisher Cache Folder of the given name, and if it does returning an NSURL to it.

Fixes #2295
Fixes #2307

* Add support for containerURLs through Publisher Cache Folders

* Use absolute path instead

* Leftover includes; comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants