I think you need to apply to Apple and get a provisioning profile, even if the app isn't sandboxed:
https://developer.apple.com/forums/thread/653890 --Michael > On Mar 14, 2021, at 5:43 AM, Allan Odgaard via Cocoa-dev > <cocoa-dev@lists.apple.com> wrote: > > 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/lists%40mjtsai.com > > This email sent to li...@mjtsai.com _______________________________________________ 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