UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

??? would like to access files in your Documents folder.

Forums > macOS

I am working through the code in the book "Learning Core Audio" by Adamson and Avila. The code builds a series of command line apps to teach Core Audio programming.

One of the examples plays the audio in a file. The original design of the code had the audio file in the same directory as the program, but every time I do a Clean Build Folder option in XCode it erases the test audio file. I modified the program to look for the audio file in my Documents directory. Now the first time I run the program after it has been rebuilt, I get a popup window with the above message. Once I allow the app to access the files in my Documents folder, I can run it as much as I want without the popup, but as soon as I make a change to the source code so that it has to recompile, I get the message again. I assume that it is because MacOS doesn't know that the recompiled program is the same one that I gave permission to.

Is there a way to suppress this message? FWIW, I looked into running the app sandboxed, but it doesn't look like sandboxing doesn't work with command line apps.

3      

I found a sortof solution. Instead of the Documents folder, I created a Data folder in the folder containg the application Build folder and placed the output file in there and referenced it as ../../../Data/filename

3      

Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.