WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

??? 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.


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


Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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.