Reputation: 1203
Where can I find more information about the “related items” feature for sandboxed mac apps? The feature is briefly introduced in the video of the “WWDC 2012 Session 700: The OS X App Sandbox” (around time index 33:39-36:03). But I cannot find where in Apple's developer documentation the feature is discussed in more detail.
From what I understand from the explanation in the video, the feature would allow a sandboxed app to declare that, for example, “if a user gives me permission to read a file with name {X}.avi, the sandbox should automatically also give me permission to read a file with name {X}.srt in the same directory.” This would allow the app to read the subtitle file that's related to the movie file without having to present the user with an(other) NSOpenPanel for “opening” the subtitle file. But the video doesn't explain how to actually declare this.
Upvotes: 2
Views: 310
Reputation: 1203
Since I posted the question, Apple seems to have updated its documentation. The feature is now described in the “App Sandbox Design Guide” in the section “Related Items”:
The related items feature of App Sandbox lets your app access files that have the same name as a user-chosen file, but a different extension. This feature consists of two parts: a list of related extensions in the application’s Info.plist file and code to tell the sandbox what you’re doing.
There are two common scenarios where this makes sense:
[...]
In both scenarios, you must make a small change to the application’s
Info.plist
file. Your app should already declare a Document Types (CFBundleDocumentTypes
) array that declares the file types your app can open.For each file type dictionary in that array, if that file type should be treated as a potentially related type for open and save purposes, add the key
NSIsRelatedItemType
with a boolean value ofYES
.To learn more about file presenters and file coordinators, read File System Programming Guide.
Upvotes: 1