Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
64 views
in Technique[技术] by (71.8m points)

c++ - XCode allow permission to open a file

This is a very simple problem that I can't find the solution to. I have a C++ application running on XCode that uses csvstream to read in files. Whenever the application ran, it would always ask me to allow XCode to access directories on my mac. I would always click allow. Now, I accidentally clicked don't allow and don't know how to get back to the settings of allow. The csvstream keeps throwing the error of "Error opening file" because I accidentally took away permission from XCode to access files on my computer. How do I undo this?

question from:https://stackoverflow.com/questions/65649185/xcode-allow-permission-to-open-a-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could try in System Preferences -> Security & Privacy -> Privacy

Scroll down the left side, there should be one says Full Disk Access. In there, you could add Xcode, or check it if it was unchecked. This should let you read all files if you run the program inside Xcode.

Similarly, in the same page, you can add Xcode to Files and Folders instead if you only want to give access to certain folders in your computer.


If this doesn't work, in Xcode, open Project Navigator, which should be in the left sidebar, or shiftcmd+J. Under Product, right click on the output program(not the product folder), and click Show in Finder, then drag the program into Full Disc Access or Files and Folders from earlier.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...