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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to