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 RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.