I’ve tried something like the code below to save a file not owned by current user.

I have codesigned the application using hardened runtime and the `com.apple.developer.security.privileged-file-operations` entitlement (although this is outside App Store and no sandboxing).

It doesn’t work and I see this error in the console: `(libsystem_secinit.dylib) com.apple.secinitd.fileoperations: xpc_pipe_routine() returned [5: Input/output error]`

Does anyone know if, when, or how it is supposed to work?

[NSWorkspace.sharedWorkspace requestAuthorizationOfType:NSWorkspaceAuthorizationTypeReplaceFile completionHandler:^(NSWorkspaceAuthorization* authorization, NSError* error){
       if(authorization) {
if([[NSFileManager fileManagerWithAuthorization:authorization] replaceItemAtURL:originalURL withItemAtURL:tempURL backupItemName:nil options:0 resultingItemURL:nil error:&error]) {

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to arch...@mail-archive.com

Reply via email to