菜鸟教程小白 发表于 2022-12-12 12:47:27

ios - 在 xcodebuild 期间代码签名验证失败并且无法读取 xcrun 的权利


                                            <p><p>我已经在这里和互联网上尝试了所有可用的解决方案。</p>

<p>我正在尝试自动化 iOS 构建过程,并且清理、构建和归档过程成功,这 5 个警告(错误)未能通过代码签名验证。</p>

<pre><code>warning: The CodeResources file is missing and it must be a symbolic link to      _CodeSignature/CodeResources.Make certain that the bundle is on a locally-mounted volume (not a remote SMB volume), and be certain to use the Mac OS X Finder to compress it (-19062)
Unable to validate your application. - (null)

warning: iPhone/iPod Touch: application executable is missing a required architecture.      At least one of the following architecture(s) must be present: armv6 (-19033)
Unable to validate your application. - (null)

warning: Icon specified in the Info.plist not found under the top level app wrapper:(-19007)
Unable to validate your application. - (null)

warning: iPhone/iPod Touch: Info.plist: Unable to verify icon dimensions, no icon found.Your MinimumOSVersion is below 3.2, so you must define CFBundleIconFile or provide a default Icon.png that is 57x57. (-19013)
Unable to validate your application. - (null)

warning: Application failed codesign verification.The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)
</code></pre>

<p>如果我尝试忽略警告或使用调试配置跳过验证代码设计,xcrun 将 .app 打包到 .ipa 失败并出现以下错误</p>

<pre><code>env SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication -v
/Users/XXXXXX/source/digital_hub/cms/final/cms_repo/H1/45/ZD/0v/U9/Rr/gT/builds/Test_22_07_13_11_31_23.app -o
/Users/XXXXX/source/digital_hub/cms/final/cms_repo/H1/45/ZD/0v/U9/Rr/gT/builds/Test_22_07_13_11_31_23.ipa
--sign iPhone\ Distribution
--embed/Users/XXXXXXX/source/digital_hub/cms/cms_local_repo/6072/76/XXXXXXXX_AppStore_11_07_1373971044.mobileprovision

error: Failed to read entitlements from &#39;/var/folders/n6/8tsx1pss5v3fq3sfpz8379r0ms3b7m/T/Rm5MudWNER/Payload/Test_22_07_13_11_31_23.app&#39;
</code></pre>

<p>当我使用工作区时,我的 xcodebuild 命令正在执行</p>

<pre><code>/usr/bin/xcodebuild -verbose
-workspace /Users/XXXXX/source/digital_hub/cms/git_local_repo/11330/80/PDFReader.git/XXXXXX.xcworkspace
-scheme _DEFAULT -sdk iphoneos -configuration Release CODE_SIGN_IDENTITY=&#34;iPhone Distribution:&#34;
PROVISIONING_PROFILE=73DE6F20-FAB9-46A2-9825-35D7DE82CD4D
CONFIGURATION_BUILD_DIR=/Users/ahsandar/source/digital_hub/cms/final/cms_repo/H1/45/ZD/0v/U9/Rr/gT/builds/Test_22_07_13_13_26_29.app
OTHER_CODE_SIGN_FLAGS=&#34;--keychain /tmp/xcoder1374496105&#34; clean
</code></pre>

<p>我的 xcrun 命令如下所示</p>

<pre><code>/usr/bin/xcrun -log -sdk iphoneos PackageApplication -v
&#34;/Users/XXXXX/source/digital_hub/cms/final/cms_repo/H1/45/ZD/0v/U9/Rr/gT/builds/Test_22_07_13_13_26_29.app&#34; -o
&#34;/Users/XXXXX/source/digital_hub/cms/final/cms_repo/H1/45/ZD/0v/U9/Rr/gT/builds/Test_22_07_13_13_26_29.ipa&#34; --sign &#34;iPhone Distribution:&#34;
--embed &#34;/Users/XXXXX/source/digital_hub/cms/cms_local_repo/11330/80/XXXXXX_AppStore_11_07_1373
</code></pre>

<p>我正在使用 xcoder gem 创建临时钥匙串(keychain)来添加我的 p12。使用命令行工具进行协同设计,对存档的所有验证均成功。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>看起来您在项目设置中设置的 minimus os 比可能的小,可能是您的图标大小错误。请再次阅读您的第一篇日志。</p>

<p>并确保为 xcodebuild 命令提供正确的参数。
对我来说 clean 与这些 args 配合得很好:</p>

<pre><code>xcodebuild clean -sdk iphoneos5.1 -project &#39;${PBXPROJ}.xcodeproj&#39; -configuration &#39;${MCONFIG}&#39; -alltargets DSTROOT=&#34;${RELEASE_BUILDDIR}&#34; PROVISIONING_PROFILE=&#34;${kPROVISONING_PROFILE}&#34; CODE_SIGN_IDENTITY=&#34;${DEVELOPER_NAME}&#34;
</code></pre>

<p>这样构建效果很好:</p>

<pre><code>xcodebuild install -sdk iphoneos5.1 -project &#34;${PBXPROJ}.xcodeproj&#34; -configuration &#34;${MCONFIG}&#34; -target &#34;${TARGET}&#34; DSTROOT=&#34;${RELEASE_BUILDDIR}&#34; PROVISIONING_PROFILE=&#34;${kPROVISONING_PROFILE}&#34; CODE_SIGN_IDENTITY=&#34;${DEVELOPER_NAME}&#34;
</code></pre>

<p>希望对你有帮助。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在 xcodebuild 期间代码签名验证失败并且无法读取 xcrun 的权利,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/17787037/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/17787037/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在 xcodebuild 期间代码签名验证失败并且无法读取 xcrun 的权利