سؤال

I wonder is it possible to keep list of files or folders opened before on sandboxed app without re-opening them or copying to it's own library ?

Thanks in advance

هل كانت مفيدة؟

المحلول

At this time only using temporary entitlements.

You should use something like

<plist version="1.0">
    <dict>
        <key>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.files.user-selected.read-write</key>
        <true/>
        <key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
        <array>
            <string>absolute path to use</string>
        </array>
    </dict>
</plist>

I hope Apple will clarify how this can be done without 'temporary' solutions because it breaks many many apps

نصائح أخرى

To keep track of files being accessed by the user, you should create security bookmarks for each file, then that will allow your application to access these files on future runs of the application without getting permission everytime.

I've made this class that wraps up persisting permissions you already have from a using opening a file via NSOpenPanel, and then you can use the class to access that file in the future.

https://github.com/leighmcculloch/AppSandboxFileAccess

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top