IOS 应用构建问题:命令 CodeSign 失败,退出代码非零

IOS App Build issue: Command CodeSign failed with a nonzero exit code

我正在尝试构建我的 IOS 应用程序(使用电容器和离子框架开发)。 在集成 Google Firebase 并添加 Resources/GoogleService-Info.plist 文件后,我在 XCode.

中构建我的应用程序时遇到以下错误

命令 CodeSign 失败,退出代码非零

CodeSign /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Products/Debug-iphonesimulator/App.app (in target 'App' from project 'App')
    cd /Users/piyush/Downloads/ncsmobileapp/ios/App
    export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    
    Signing Identity:     "-"
    
    /usr/bin/codesign --force --sign - --entitlements /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/App.app.xcent --timestamp\=none --generate-entitlement-der /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Products/Debug-iphonesimulator/App.app

/Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Products/Debug-iphonesimulator/App.app: code object is not signed at all
In subcomponent: /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Products/Debug-iphonesimulator/App.app/AppIcon60x60@2x.png
Command CodeSign failed with a nonzero exit code

我尝试清理构建缓存,重新启动 xcode。 通过电容器重新构建应用程序,但还没有解决这个问题。 谁能帮忙解决这个问题?

更新

归档应用程序时出现以下错误:

CodeSign /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app (in target 'App' from project 'App')
    cd /Users/piyush/Downloads/ncsmobileapp/ios/App
    export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    
    Signing Identity:     "Apple Development: Piyush Aggarwal (ZWHGYV6A62)"
    Provisioning Profile: "iOS Team Provisioning Profile: app.neo.school"
                          (d2353688-03d7-47ff-942f-4f34fd4c6a93)
    
    /usr/bin/codesign --force --sign 5FE6CDFE4B615D56B70C5DAEB7A151005A1122AE --entitlements /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/App.app.xcent --generate-entitlement-der /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app

/Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app: code object is not signed at all
In subcomponent: /Users/piyush/Library/Developer/Xcode/DerivedData/App-cfgpruswvcmgvpcxuzeyccwfgdyx/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/AppIcon60x60@2x.png
Command CodeSign failed with a nonzero exit code

请尝试删除派生数据并清理构建。

删除派生数据的步骤:-

1.Open 您的项目,转到文件 -> 工作区设置

然后你会发现一个带箭头的派生数据位置:-

只需点击那个箭头,之后你会发现一个名为derived data的文件夹, 删除派生数据文件夹中的所有文件。 然后它会工作正常。

问题是由资源文件夹引起的。 我创建了那个文件夹来添加我的 GoogleServices-Info.plist 文件。

我重命名了我的资源文件夹,并按照 xcode 中应用程序构建短语中的代码更改了 GoogleServices-Info.pllist 文件的路径:

PATH_TO_GOOGLE_PLISTS="${PROJECT_DIR}/App/[FOLDER NAME]"

        cp -r "$PATH_TO_GOOGLE_PLISTS/GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;