一、原因:缺少DER entitlement
解释一下DER:DER is short fro Distinguished Encoding Rules and is a standard by which ASN.1 structures are transferred. ASN.1 is a standard by which data can be encoded and decoded no matter which platform is being used. ASN.1 in this specific case applies to data encoding
简单的说就是一种加密方式。
二、错误提示:validation failed because of missing DER entitlements
[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 74: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.xbDKXR/extracted/Payload/*********.app : 0xe8008029 (The code signature version is no longer supported.)
三、解决办法:
3.1、看自己的macOS的系统版本:如果是macOS Big Sur or macOS Monterey,那么直接加上flag:--generate-entitlement-der 即可,
【怎么加--generate-entitlement-der】:<1> xcode中build setting 中OTHER_CODE_SIGN_FLAGS:--generate-entitlement-der
<2> re-sign,这个对单个APP可以
# Re-sign your app
% codesign -s "Signing Identity Name from Keychain" -f --preserve-metadata --generate-entitlement-der MyApp.app
...
MyApp.app: replacing existing signature
# Check your signature again
% codesign -dvvvvv ActionExtensionHostSSO.app
...
Page size=4096
-7=4ade7be00e0a7b6db853edc4843e7ece1eea646f6f13d1809f78fc50d8db461f
-6=0000000000000000000000000000000000000000000000000000000000000000
-5=1dfa58bd8ac3c4fb42142c1c4d28c436128b3a7460186a44526194fb690112bc
-4=0000000000000000000000000000000000000000000000000000000000000000
-3=ef08dbe5a7c355336e1fb571604b683ce1c54536cb59a6155a1d18387fd23f6e
-2=5b730fa46ffd405fd88da9606d82eda9af7f460f6049047afc176163326f5a7f
...
3.2 如果macOS Mojave and Catalina以下的,在xcode下也可以编译成功,然后打包payload成ipa也可以安装。但是在archive下直接生成ipa不行,
这个必须就要升级macOS的系统了。因为这个--generate-entitlement-der新flag。
ref:
https://developer.apple.com/forums/thread/682775?page=2