My sandboxed AUv3 plugin cannot access user selected samples

Hello

I store in my plugin path to the user selected sample from HDD. The
sample loads fine when drag n dropped but recall and reload from preset
or project in Logic Pro is causing “operation not permitted” error. How to solve
that? Setting full disk access for Logic or my AU3 App (cannot set it
for appex) does not work.
Accepted Answer

Setting full disk access for Logic or my AU3 App (cannot set it for
appex) does not work.

That’s definitely a dead end, because Full Disk Access is a MAC thing and you’re hitting an App Sandbox wall. See my On File System Permissions post for more background on this.

The sample loads fine when drag n dropped but recall and reload from
preset or project in Logic Pro is causing “operation not permitted”
error.

I’m not familiar with the ins and outs of audio units but this general problem — retaining long-term access to an item that you previously had access to — is generally solved using security-scoped bookmarks. See the Security-Scoped Bookmarks and Persistent Resource Access section of App Sandbox in Depth for more.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Thanks. This is what I needed.
Hello eskimo
One more question. My sandboxed application still has access to my Application Support folder without problem. Is the permission still conditionally available?

My sandboxed application still has access to my Application Support
folder without problem.

Which Application Support folder? Consider this:

Code Block
let u = try! FileManager.default.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
print(u.path)


which prints this:

Code Block
/Users/quinn/Library/Containers/com.example.apple-samplecode.Test679409/Data/Library/Application Support


So, you normally end up referencing the Application Support folder in your app’s container, and you obviously have access to that.

Now imagine you have a file in your ‘real’ Application Support folder:

Code Block
% cat "/Users/quinn/Library/Application Support/tmp.txt"
Hello Cruel World!


This code:

Code Block
let u2 = URL(fileURLWithPath: "/Users/quinn/Library/Application Support/tmp.txt")
do {
_ = try Data(contentsOf: u2)
} catch {
print(error)
}


prints this:

Code Block
Error Domain=NSCocoaErrorDomain Code=257 "The file “tmp.txt” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/quinn/Library/Application Support/tmp.txt, NSUnderlyingError=0x60000084ed00 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}


So you don’t, by default, have access to the user’s Application Support folder.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
My sandboxed AUv3 plugin cannot access user selected samples
 
 
Q