EvenBetterAuthorizationSample
EvenBetterAuthorizationSample copied to clipboard
Apple's EvenBetterAuthorization Sample Project
HelperTool + XPCService Project Setup
This is how to set everything up (I believe)
The original Apple Doc for this project can be found in README-APPLE
In this example the 3 identifiers for the 3 targets are
| Name | Identifier |
|---|---|
| Broker (Main app) | com.blackwellapps.Broker |
| BrokerHelper (HelperTool) | com.blackwellapps.BrokerHelper |
| XPCService | com.blackwellapps.XPCService |
1 Add Copy File build phase
Main App
Add Copy File build phase to main app target:
Destination: Wrapper
Subpath: Contents/LibraryXPCServices,
Codesign on Copy:Disable.

XPCService
Add Copy File build phase to XPCService target:
Destination: Wrapper
Subpath: Contents/Library/LaunchServices,
Codesign on Copy:Disable.

2 Modify Info.plists
XPCService-Info.plist (Tools owned after installation)
Add a new key value pair to the XPCService's Info.plist
- Key: "Tools owned after installation"
- Type: dictionary
Inside this new dictionary add a another key value pair:
- Key:
Your helper's bundle identifier - Type: string
- Value: "anchor apple generic and certificate leaf[subject.CN] =
Certificate Nameand certificate 1[field.1.2.840.113635.100.6.2.1] / exists /"

HelperTool-Info.plist (Clients allowed to add and remove tool)
Add a new key value pair the HelperTools's Info.plist
- Key: "Clients allowed to add and remove tool"
- Type: array
As this is an array, we will add a new item to the 0 index:
- Key/Position: "Item 0"
- Type: string
- Value: "identifier
XPCService identifierand anchor apple generic and certificate leaf[subject.CN] =Certificate Nameand certificate 1[field.1.2.840.113635.100.6.2.1] / exists /"

3 Developer ID
Choose Developer ID:* in Code Signing Identity in build settings for each targets.
Main App

XPCService

HelperTool

4 Build
Build the app.
5 SMJobBlessUtil.py
Use SMJobBlessUtil.py cli script
Update Info.plist:
Format: $ ./SMJobBlessUtil.py setreq <XPCService path> <XPCService's Info.plist path> <Helper's Info.plist>
./SMJobBlessUtil.py setreq Build/Products/Debug/com.blackwellapps.XPCService.xpc XPCService/XPCService-Info.plist BrokerHelper/HelperTool-Info.plist HelperTool/HelperTool-Info.plist
Check Code Signing status:
Format: $ ./SMJobBlessUtil.py check <XPCservice path>
./SMJobBlessUtil.py check Build/Products/Debug/com.blackwellapps.XPCService.xpc
Troubleshooting
- If it doesn't pass the CLI
checkthen make sure #3 is correct - Also Make sure each .plist file is set as Info.plist in the corresponding Target's Build settings.
Credit
Got some of this from this gist https://gist.github.com/xiao99xiao/0509091001bdd6259249