Re: NSData -writeToFile: returns FALSE


Jon Gotow
 

Yeah, that's part of the TCC (transparency, consent and control) privacy stuff in Mojave and higher. Without Full Disk Access, your app is prevented from accessing some filesystem locations unless it has been explicitly or implicitly allowed by the user. That means that you're given an access right if you use an Open or Save As dialog to prompt the user to select a file or location, or if you ask the system for a temp folder for use by your app (AFAIK, you're not allowed to generically read or write to /tmp because that might allow you to see other applications' temp files). Oh - or if the user implicitly permits access by dragging or double-clicking a file to open it.

Apple has ratcheted up the number of folders that are protected this way in the last few OS releases. Mojave was fairly permissive - it only refused to let you see Contacts, Calendar, Messages, Photos, Mail and Safari folders, I think. Catalina added Desktop, Documents, Downloads, iCloud Drive and removable volumes, which ends up impacting a lot more software.

- Jon

On Dec 10, 2020, at 7:17 PM, Carl Hoefs <newslists@autonomy.caltech.edu> wrote:

Interesting idea. That worked! I never knew that "Full Disk Access" even existed.

-Carl


On Dec 10, 2020, at 5:58 PM, Jon Gotow <gotow@stclairsoft.com> wrote:

Just out of curiosity - go to System Preferences > Security & Privacy > Full Disk Access, click on the padlock in the lower left corner to unlock, then drag your app to the list. Does that fix things?

- Jon


On Dec 10, 2020, at 6:54 PM, Carl Hoefs <newslists@autonomy.caltech.edu> wrote:

On Dec 10, 2020, at 5:16 PM, Shane Stanley <sstanley@myriad-com.com.au> wrote:

On 11 Dec 2020, at 11:59 am, Carl Hoefs <newslists@autonomy.caltech.edu> wrote:

Adding NSDesktopFolderUsageDescription forces the addition of a provisioning profile, et al.
No it doesn't. It's a simple Info.plist entry.
Ah, yes, you're right. I had added it to the .entitlements file.

I added it to the Info.plist file but no change in behavior...

-Carl


Join xcode@apple-dev.groups.io to automatically receive all group messages.