My app needs an installer to do a couple of things with a helper app. For historical reasons I have a self-written installer. I had the stupid idea to change from the old AuthorisationMBS to newer methods of NSWorkspaceMBS authorisation. This works fine. Except that the authorisation isn’t authoritative enough when used on a non-admin user.
Here is my code for NSWorkspaceMBS:
myworkspace = New NSWorkSpaceMBS
AddHandler myWorkspace.RequestAuthorizationCompleted, AddressOf RequestAuthorizationCompletedHandler
myworkspace.requestAuthorization(myworkspace.NSWorkspaceAuthorizationTypeReplaceFile)
Then I want to create a new folder in Applications:
Dim theFileManager As NSFileManagerMBS = NSFileManagerMBS.fileManagerWithAuthorization(myAuthorisation)
dim theError as NSErrorMBS
'create folder for application
dim AppFolder as FolderItem = FolderitemUtils.getApplicationsFolder
if AppFolder = nil or not AppFolder.Exists then
Globals.theErrorLog.logitem currentMethodName + " no application folder"
Return kErrorApplicationFolder
end if
AppFolder = AppFolder.Child(AppCommon.getInstallationAppName)
if AppFolder <> nil and not AppFolder.Exists then
if not theFileManager.createDirectory(AppFolder, False, Nil, theError) then
if theError <> Nil then
Return kErrorApplicationFolder + EndOfLine + kError + " " + theError.LocalizedDescription
end if
end if
end if
This fails with the following error:
I’ve been in contact with Christian who doesn’t have an idea either how to solve this. He sent me some links:
https://www.mail-archive.com/cocoa-dev@lists.apple.com/msg110005.html
https://developer.apple.com/forums/thread/653890
I read this that there is a special entitlement for MAS apps. But I haven’t a clue what to do for my non-MAS app.