Re: NSData -writeToFile: returns FALSE


Carl Hoefs
 

Yes, the NSError object is nil, but the return status from the invocation is FALSE. Since it's nil, I suspect some app environment issue...

-Carl

On Dec 10, 2020, at 3:10 PM, Steve Christensen via groups.io <punster=mac.com@groups.io> wrote:

I wasn’t clear from your description, but are you calling -writeToFile:options:error:? If so then I would expect that the error might give you at least some clue.

And I haven’t worked on macOS apps in years, but at east as a user I periodically see permissions alerts pop up on my 10.15 iMac asking if an app can write to the desktop, the documents folder, etc. Maybe related to that?


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

I think I might have an entitlements issue with my in-house macOS app (10.14). It needs to write to the user's ~/Desktop. NSData's -writeToFile: returns FALSE, even if I try to write to /tmp. Heck, even if I try to write to /dev/null.

I have App Sandbox=NO, and com.apple.security.files.user-selected.read-write=YES

Is there another entitlement I'm needing?

-Carl




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