Morning Quinn,
Are you building your Info.plist and .entitlements file with Apple tools? Modern systems apply additional constraints on security-sensitive XML files. See Ensure Properly Formatted Entitlements for more on this.
I am not building either the info.plist or the entitlements file using Apple's tools.
I am using [NSPropertyListSerialization dataWithPropertyList:format:options:error:] to create a NSData object of format kCFPropertyListXMLFormat_v1_0 which is then written to the file using a stream.
plutil -lint ~/mainEntitlementsAppStore.entitlements
~/mainEntitlementsAppStore.entitlements: OK
codesign -d --entitlements :- ~/Aqua\ Swatch.app
Executable= ~/Aqua Swatch.app/Contents/MacOS/Aqua Swatch
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.application-identifier</key>
<string>QXAFMEPH6X.com.ohanaware.aquaSwatch</string>
<key>com.apple.developer.team-identifier</key>
<string>QXAFMEPH6X</string>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>QXAFMEPH6X.com.ohanaware.aquaSwatch</string>
</array>
</dict>
</plist>
If the mainEntitlements only consists of com.apple.security keys, the application launches.
Once "com.apple.application-identifier", "com.apple.developer.team-identifier" or "keychain-access-groups" is added to the entitlements the application crashes on launch.
Below is the console information from just this moment.
default 10:18:19.639377+0800 amfid /Applications/Aqua Swatch.app/Contents/MacOS/Aqua Swatch signature not valid: -67671
default 10:18:19.639463+0800 kernel mac_vnode_check_signature: /Applications/Aqua Swatch.app/Contents/MacOS/Aqua Swatch: code signature validation failed fatally: When validating /Applications/Aqua Swatch.app/Contents/MacOS/Aqua Swatch:
Code has restricted entitlements, but the validation of its code signature failed.
Unsatisfied Entitlements:
default 10:18:19.639513+0800 kernel proc 32652: load code signature error 4 for file "Aqua Swatch"
default 10:18:19.640376+0800 kernel ASP: Security policy would not allow process: 32652, /Applications/Aqua Swatch.app/Contents/MacOS/Aqua Swatch
default 10:18:19.640408+0800 kernel Aqua Swatch[32652] Corpse allowed 1 of 5
default 10:18:19.647641+0800 ReportCrash Parsing corpse data for process Aqua Swatch [pid 32652]
error 10:18:19.704941+0800 CoreServicesUIAgent handle LS launch error: {\n Action = oapp;\n AppMimimumSystemVersion = "10.11";\n AppPath = "/Applications/Aqua Swatch.app";\n ErrorCode = "-10826";\n}
default 10:18:19.808839+0800 *** Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file “PlugIns” couldn’t be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Applications/Aqua%20Swatch.app/Contents/, NSFilePath=/Applications/Aqua Swatch.app/Contents/PlugIns, NSUnderlyingError=0x7f9dfb91f9e0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
default 10:18:19.969116+0800 *** Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file “PlugIns” couldn’t be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Applications/Aqua%20Swatch.app/Contents/, NSFilePath=/Applications/Aqua Swatch.app/Contents/PlugIns, NSUnderlyingError=0x7f9dfb843d80 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
default 10:18:19.998976+0800 ReportCrash Saved crash report for Aqua Swatch[32652] version ??? to Aqua Swatch_2021-10-26-101819_Mariposa.crash
default 10:18:20.008882+0800 analyticsd Received event: com.apple.stability.crash {"appVersion":"???","exceptionType":13,"incidentID":"1B2F176A-1FCA-47CC-AE21-9A4EA88E0C81","logwritten":1,"process":"Aqua Swatch","responsibleApp":"Aqua Swatch"}
default 10:18:20.008759+0800 ReportCrash Sending event: com.apple.stability.crash {"appVersion":"???","exceptionType":13,"incidentID":"1B2F176A-1FCA-47CC-AE21-9A4EA88E0C81","logwritten":1,"process":"Aqua Swatch","responsibleApp":"Aqua Swatch"}
default 10:18:20.014245+0800 analyticsd Aggregated. Transform: StabilityCrashNumerator3WithIncidentID Dirty: 1 Event: com.apple.stability.crash {"appVersion":"???","exceptionType":13,"incidentID":"1B2F176A-1FCA-47CC-AE21-9A4EA88E0C81","logwritten":1,"process":"Aqua Swatch","responsibleApp":"Aqua Swatch","timestamp":1635214700008705}
default 10:18:20.014302+0800 analyticsd Aggregated. Transform: StabilityCrashNumerator3 Dirty: 1 Event: com.apple.stability.crash {"appVersion":"???","exceptionType":13,"incidentID":"1B2F176A-1FCA-47CC-AE21-9A4EA88E0C81","logwritten":1,"process":"Aqua Swatch","responsibleApp":"Aqua Swatch","timestamp":1635214700008705}
default 10:18:20.014359+0800 analyticsd Aggregated. Transform: StabilityCrashNumerator3WithBundleVersion Dirty: 1 Event: com.apple.stability.crash {"appVersion":"???","exceptionType":13,"incidentID":"1B2F176A-1FCA-47CC-AE21-9A4EA88E0C81","logwritten":1,"process":"Aqua Swatch","responsibleApp":"Aqua Swatch","timestamp":1635214700008705}
% security error -67671
Error: 0xFFFEF7A9 -67671 An internal error has occurred.
If I remove these keys, and rewrap the application, it launches with no error. "com.apple.application-identifier", "com.apple.developer.team-identifier" and "keychain-access-groups".
One final thing, clutching at staws, the permissions of the executables are all 755, while the provisionprofile is 666, I guess it should be 644.
Thank you for your patience and willingness to assist me.