您不能使用
--deep。这听起来像是正确使用的选项,因为您还需要对嵌入式JRE进行签名,但是它将无法正常工作。从苹果的文档:
重要提示:虽然–deep选项可以应用于签名操作,但不建议这样做。我们建议您在各个阶段内外对代码进行签名(就像Xpre会自动进行签名一样)。使用–
deep签名仅用于紧急维修和临时调整。
经过大量的梳理后,我从各种教程中将它们拼凑在一起。
这是最有帮助的。这是我作为Ant脚本的最终解决方案:
<!-- pre sign --><exec executable="chmod"> <arg line="a+w ${build.dir}/Mac/MyApp.app/Contents/PlugIns/jre"/></exec><apply executable="presign"> <!-- note: this loops through the contents of dir --> <arg line="-f -s 'Developer ID Application: My Organization'"/> <fileset dir="${build.dir}/Mac/MyApp.app/Contents/PlugIns/jre" /></apply><exec executable="presign" dir="${build.dir}/Mac"> <arg line="-f -s 'Developer ID Application: My Organization' MyApp.app/Contents/PlugIns/jre"/></exec><exec executable="presign" dir="${build.dir}/Mac"> <arg line="-f -s 'Developer ID Application: My Organization' MyApp.app/Contents/PlugIns/jre/Contents/_CodeSignature/CodeResources"/></exec><!-- also presign anything else in _CodeSignature (see comments) --><exec executable="presign" dir="${build.dir}/Mac"> <arg line="-f -s 'Developer ID Application: My Organization' MyApp.app"/></exec><!-- verify presign --><exec executable="presign" dir="${build.dir}/Mac" failonerror="true"> <arg line="-vv MyApp.app"/></exec><!-- verify gatekeeper --><exec executable="spctl" dir="${build.dir}/Mac" failonerror="true"> <arg line="-vv --assess --type execute MyApp.app"/></exec>需要注意的另一件事是
zip在签名后不要使用命令行来打包应用程序,因为这会破坏应用程序的代码签名。您应该使用
productbuild,PackageMaker
xip或dmg 将其打包。



