I'm trying to remove a file form the ~/Library/PreferencePanes folder, and this cannot be done with normal privileges. Usually, if you need to delete any file from the ~/Library folder the system will ask for your username and password.
The current way I do this is with
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error]
but this keeps on returning an error ([error localizedDescription]
):
theAppName.prefPane couldn’t be removed because you don’t have permission to access it.
What logic and code would I need to use in order to gain these elevated privileges needed for deleting files?
Thanks!