I wrote a little macOS troubleshooting utility which I need to send to a few users. I don't want it sandboxed because I it needs NSHomeDirectory() to return the user's real home directory, /Users/me.
In the app target's Signing and Capabilities tab, I removed App Sandbox. When I test the app running in Xcode, NSHomeDirectory() returns /Users/me as required. After the app worked to my satisfaction, I clicked Archive, then Upload for notarizing, then Export.
The spctl tool assesses the exported, notarized app product as Notarized Developer ID, and upon running, in Activity Monitor, the Sandbox column reads No. However, this product does not function correctly because NSHomeDirectory() is returning the following path:
/Users/me/Library/Containers/com.myCompany.MyOtherApp/Data
wherein MyOtherApp is the name of the last sandboxed macOS app I started developing a couple months ago. ARGHHH!! Where in the world did it get that? I definitely started this as a New Project.
In the Build Settings, I have
Code Signing Style = Manual
Code Signing Identity = Developer ID Application
But I have also tried:
Code Signing Style = Automatic
Code Signing Identity = Apple Development
Either way, upon executing Archive-Upload-Export workflow and testing the product, it has this same problem.
Note: I've never used Xcode's built-in workflow for Developer ID before, due to issues when Apple first released it. I wrote and since 2012 have been using my own script instead. But yesterday I thought I would try Xcode's built-in workflow because I read that Apple has fixed the issues over the years. Have they? What have I done wrong?
In the app target's Signing and Capabilities tab, I removed App Sandbox. When I test the app running in Xcode, NSHomeDirectory() returns /Users/me as required. After the app worked to my satisfaction, I clicked Archive, then Upload for notarizing, then Export.
The spctl tool assesses the exported, notarized app product as Notarized Developer ID, and upon running, in Activity Monitor, the Sandbox column reads No. However, this product does not function correctly because NSHomeDirectory() is returning the following path:
/Users/me/Library/Containers/com.myCompany.MyOtherApp/Data
wherein MyOtherApp is the name of the last sandboxed macOS app I started developing a couple months ago. ARGHHH!! Where in the world did it get that? I definitely started this as a New Project.
In the Build Settings, I have
Code Signing Style = Manual
Code Signing Identity = Developer ID Application
But I have also tried:
Code Signing Style = Automatic
Code Signing Identity = Apple Development
Either way, upon executing Archive-Upload-Export workflow and testing the product, it has this same problem.
Note: I've never used Xcode's built-in workflow for Developer ID before, due to issues when Apple first released it. I wrote and since 2012 have been using my own script instead. But yesterday I thought I would try Xcode's built-in workflow because I read that Apple has fixed the issues over the years. Have they? What have I done wrong?
It's hard to say. This is not something that Xcode normally does. What are you using as the Bundle Identifier for this app? Are you reusing com.myCompany.MyOtherApp? Bundle identifiers have to be unique. On a developer's machine, they never are, so you should always tests in a pristine setup like a virtual machine. Depending on how your app is being launched, the bundle identifier can change the behaviour and cause some other binary to be executed instead.What have I done wrong?