Unable to read user file after Mac OS and Xcode update

Hi,

I was able to read a user file and open it using fopen() in my Xcode project while App Sandboxing was ON. Recently I updated my Mac OS and along with it Xcode to the latest. Although I am able to open the file using file_importer on swift, I am not able to open it using fopen(). It always returns a NULL, however I am able to open it when Sandboxing is switched Off. What could be the issue? All my entitlements are the same, only thing that changed was the update that I had made.

Best,

Vishnu

is the file inside your app's sandbox? You haven't said where it is.

fileimporter (not file_importer) puts up a user interface, so the user is granting explicit permission to access the file.

fopen() doesn't have UI, so it has to get the permission from somewhere else. That somewhere else can be implicit (the path leads to somewhere in the app's sandbox), or you can get the path by resolving a security scoped bookmark which you have created earlier by interacting with the user.

Unable to read user file after Mac OS and Xcode update
 
 
Q