Hi,
I am in the process of building a macOS app that needs access to file metadata (amongst which the ownerAccountId). Trying to change properties like owner and group id results in an Operation Not Permitted error.
From what I understand one needs Privileged File Operation entitlements for such operations.
I am having a hard time figuring out how to achieve this. I have been searching the internet and forums, to no avail. The documentation does not offer a solution either. And it is unclear to me if you have to apply for entitlements when (still) developing and debugging an application for macOS (not ready for publication in the AppStore yet).
Does anybody know a proper 'how to' on using entitlements. Which entitlement, when and how to apply them? A step-by-step read would be perfect.
In case you would like to answer directly... more specifically my code consists of a bunch of 'utility functions' in a framework. I included unit tests in the framework to be able to test the functionality. One of the tests would be testSettingAccountId, that tests some function that sets a file attribute (FileAttributeKey.ownerAccountID) on some test file. Right now that test fails due to insufficient permissions, which is understandable. I would like to know how I can set ups the environment to properly test the function. That is: do I need to set entitlements. If so, which one(s) and where would I set these in order for the unit test to run successfully?
Any help would be much appreciated. Thanks!
I am in the process of building a macOS app that needs access to file metadata (amongst which the ownerAccountId). Trying to change properties like owner and group id results in an Operation Not Permitted error.
From what I understand one needs Privileged File Operation entitlements for such operations.
I am having a hard time figuring out how to achieve this. I have been searching the internet and forums, to no avail. The documentation does not offer a solution either. And it is unclear to me if you have to apply for entitlements when (still) developing and debugging an application for macOS (not ready for publication in the AppStore yet).
Does anybody know a proper 'how to' on using entitlements. Which entitlement, when and how to apply them? A step-by-step read would be perfect.
In case you would like to answer directly... more specifically my code consists of a bunch of 'utility functions' in a framework. I included unit tests in the framework to be able to test the functionality. One of the tests would be testSettingAccountId, that tests some function that sets a file attribute (FileAttributeKey.ownerAccountID) on some test file. Right now that test fails due to insufficient permissions, which is understandable. I would like to know how I can set ups the environment to properly test the function. That is: do I need to set entitlements. If so, which one(s) and where would I set these in order for the unit test to run successfully?
Any help would be much appreciated. Thanks!