I am currently writing a software product which involves a Camera Extension and a Cocoa application. I would like to share some files between the two components and as of my understanding this should be quite straightforward by putting both applications into the same App Group and then accessing the particular Group Container.
However doing so, does result in both components accessing different locations for the Group Container. I am using the following piece of code to create a new folder inside the container:
let directory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.235ADAK9D5.com.creativetoday.camskool")!
let newDirectory = directory.appendingPathComponent("Mydir")
try? FileManager.default.createDirectory(at: newDirectory, withIntermediateDirectories: false)
If I run this I find that the Cocoa application is going to access the following Location and create the file there:
/Users/<username>/Library/Group Containers/<App Group>/"
Where as the Camera Extension will access the following Location and create the directory there:
/private/var/db/cmiodalassistants/Library/Group Containers/<App Group>/
If I create a file in one directory it does not appear in the other. I tried for both components to access the opposite directory but it results in an permission denied message.
What am I doing wrong?
To be clear, we’re talking about Core Media I/O extensions, right?
If so, this:
as of my understanding this should be quite straightforward by putting both applications into the same App Group
won’t work because app groups only work between apps run by the same user. Your main app is being run by some logged in GUI user but your camera extension is not; it’s run by the _cmiodalassistants
role account.
I would like to share some files between the two components
What sort of content are we talking about?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"