使用 Xcode 和 Fastlane 在 Azure DevOps Pipelines 中对 iOS 应用程序进行代码签名时遇到问题

Posted

技术标签:

【中文标题】使用 Xcode 和 Fastlane 在 Azure DevOps Pipelines 中对 iOS 应用程序进行代码签名时遇到问题【英文标题】:Trouble code signing iOS application in Azure DevOps Pipelines with Xcode and Fastlane 【发布时间】:2019-05-23 16:47:05 【问题描述】:

我正在使用 Azure DevOps Pipelines 为我的 ios 应用程序设置 CICD 服务器,但在代码签名方面遇到了问题。我认为问题是 Xcode 无法访问钥匙串,因此它会提示我输入密码并提供访问权限 - 我无法输入此密码,因为它在 CI 服务器中无头运行。

我在使用 xcodebuild 和 Fastlane gym 时遇到了同样的问题。

Xcode 构建

xcodebuild build -workspace './ios/myApp.xcworkspace' -scheme 'myApp' -verbose

提示输入钥匙串密码的输出行:

GenerateDSYMFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app.dSYM /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/myApp (in target: myApp)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios
    /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/myApp -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app.dSYM

PBXCp /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/Lottie.framework /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework (in target: myApp)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude \*.tbd -strip-debug-symbols -bitcode-strip replace-with-marker -bitcode-strip-tool /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip -strip-tool /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/Lottie.framework /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks
/Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -S /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/Lottie.framework/Lottie -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework/Lottie 
/Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework/Lottie -m -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework/Lottie 

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-target-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-target-headers.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.o /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    export LANG=en_US.US-ASCII
    /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DPOD_CONFIGURATION_RELEASE=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_RELEASE=1 -DGPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 -DPOD_CONFIGURATION_RELEASE=1 -DPB_FIELD_32BIT=1 -DPB_NO_PACKED_STRUCTS=1 -DPB_ENABLE_MALLOC=1 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode_10.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -fembed-bitcode-marker -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap -ivfsoverlay /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/include -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Firebase -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseAnalyticsInterop -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseCore -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseInstanceID -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseMessaging -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/GoogleUtilities -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Protobuf -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/nanopb -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Firebase/CoreOnly/Sources -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources-normal/armv7 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources/armv7 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources -F/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/FirebaseAnalytics/Frameworks -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/GoogleAppMeasurement/Frameworks -MMD -MT dependencies -MF /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.d --serialize-diagnostics /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.dia -c /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.o

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.o /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    export LANG=en_US.US-ASCII
    /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DPOD_CONFIGURATION_RELEASE=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_RELEASE=1 -DGPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 -DPOD_CONFIGURATION_RELEASE=1 -DPB_FIELD_32BIT=1 -DPB_NO_PACKED_STRUCTS=1 -DPB_ENABLE_MALLOC=1 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode_10.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -fembed-bitcode-marker -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap -ivfsoverlay /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/include -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Firebase -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseAnalyticsInterop -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseCore -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseInstanceID -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseMessaging -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/GoogleUtilities -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Protobuf -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/nanopb -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Firebase/CoreOnly/Sources -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources-normal/arm64 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources/arm64 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources -F/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/FirebaseAnalytics/Frameworks -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/GoogleAppMeasurement/Frameworks -MMD -MT dependencies -MF /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.d --serialize-diagnostics /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.dia -c /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.o

CodeSign /Users/vsts/Library/Developer/Xcode/DerivedData/safepoint-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/safepoint.app/Frameworks/Lottie.framework (in target: safepoint)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios
    export CODESIGN_ALLOCATE=/Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "iPhone Developer: XXXX XXXXX (XXXXXX)"
Provisioning Profile: "match Development com.jamesrogers.myApp"
                      (XXXXXXXXXXXXXXXXXXXXXXXXXx)

    /usr/bin/codesign --force --sign 91BB2EBDF2635F1D8B951B60FDA0CB8406EA5B85 --timestamp=none --preserve-metadata=identifier,entitlements,flags /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework

快车道健身房

gym(scheme: 'myApp', workspace: './ios/myApp', verbose: true)

提示输入钥匙串密码的输出行:

Generating 'myApp.app.dSYM'
‌Copying‌ /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/Lottie.framework‌

尝试的解决方案

我尝试了两种方法来解决这个问题,但它们都导致 Xcode 提示我访问钥匙串。

    我尝试解锁钥匙串,但未能在网上找到有关如何解锁的任何具体信息。首先,我不知道使用什么钥匙串或使用什么密码。从我找到here 的一些信息来看,默认钥匙串的密码“通常是启动代理的用户的密码”。这是否意味着它是我的 azure devops 帐户的密码?然后我运行以下命令来查看我所有可用的钥匙串:
security list-keychains

// output
"/Users/vsts/Library/Keychains/login.keychain-db"
"/Library/Keychains/System.keychain"

我假设默认钥匙串是login.keychain-db,因为我无权访问System.keychain

使用我的 azure devops 帐户密码和 fastlane 运行以下命令(就在比赛和健身房之前):

unlock_keychain(
  path: "/Users/vsts/Library/Keychains/login.keychain-db",
  password: "myPassword")
)

或使用安全工具(在快车道比赛和健身房之前):

security unlock-keychain -p myPassword /Users/vsts/Library/Keychains/login.keychain-db

这仍然会导致同样的问题。我还从 fastlane 比赛中收到了一些警告:

[12:06:53]: ‌Could not configure imported keychain item (certificate) to prevent UI permission popup when code signing‌Check if you supplied the correct `keychain_password` for keychain: `/Users/vsts/Library/Keychains/login.keychain-db`security: SecKeychainItemSetAccessWithPassword: The user name or passphrase you entered is not correct.‌
[12:06:53]: 
[12:06:53]: ‌Please look at the following docs to see how to set a keychain password:‌
[12:06:53]: ‌ - https://docs.fastlane.tools/actions/sync_code_signing
‌[12:06:53]: ‌ - https://docs.fastlane.tools/actions/get_certificates‌

这表示钥匙串名称或密码不正确,并告诉我 xcode 会提示我输入钥匙串密码。有人知道密码应该是什么吗?

    我的另一个尝试是创建一个新的钥匙串来安装和读取证书。我已经尝试过使用内置的 fastlane 操作和安全命令实用程序。我还将新创建的钥匙串设置为默认值,将其添加到搜索列表并解锁。

在比赛和健身房之前的 Fastfile 中:

create_keychain(
  name: 'ios-build',
  password: 'password123',
  default_keychain: true,
  unlock: true,
  add_to_search_list: true
)

或使用安全工具(在快车道比赛和健身房之前):

security create-keychain -p password123 ios-build.keychain // create keychain
security list-keychains -d user -s login.keychain ios-build.keychain // add to search path
security unlock-keychain -p password123 /Users/vsts/Library/Keychains/ios-build.keychain-db // unlock

我还设置了MATCH_KEYCHAIN_NAMEMATCH_KEYCHAIN_PASSWORD 环境变量来引用这个新的钥匙串。

这一次,来自 match 的警告消失了(表明它已将证书和配置文件正确安装到新的钥匙串),但在构建时它仍然挂在钥匙串密码提示上。我还用钥匙串的空密码尝试了这个 - 完全相同的问题。我想知道 Xcode 是否仍在尝试访问原始的默认钥匙串,而不是新创建的钥匙串?如果是这样,我是否需要配置 xcode/gym 来查找新创建的钥匙串?

我正在使用的工具:

Microsoft 托管代理:macOS-10.14 Xcode:10.2.1 快车道:2.123.0

【问题讨论】:

您的问题不包括您遇到的实际问题,请添加您得到的输出以及您认为这指向您发现的问题的原因。跨度> 嗨@janpio,对此感到抱歉。我已经用输出编辑了问题 您添加的输出没有清楚地显示问题 - 您能否在 事情卡住之前添加更多行(并定义这实际上意味着什么)?您可以在本地成功使用您的 fastlane 配置来构建您的应用程序吗?你在用docs.fastlane.tools/actions/setup_ci吗? 我提供了额外的日志输出。我所说的卡住的意思是 Xcode 提示我输入钥匙串密码以进行代码签名。我没有看到 setup_ci 操作。我会试一试并报告:) @janpio 感谢setup_ci,我的构建刚刚成功完成。我不确定我的手动临时钥匙串修复哪里出错了。非常感谢您的帮助:) 如果您提交答案,我可以将其标记为已接受 【参考方案1】:

Fastlane 有一个动作setup_ci,可用于准备钥匙串并匹配在 CI 环境中使用。

provider 参数是可选的,但如果您的 CI 提供程序未自动正确识别,您可能必须设置 force:true。 (如果是这种情况,请在 fastlane 中打开一个问题。谢谢。)

【讨论】:

以上是关于使用 Xcode 和 Fastlane 在 Azure DevOps Pipelines 中对 iOS 应用程序进行代码签名时遇到问题的主要内容,如果未能解决你的问题,请参考以下文章

在 Xcode 11 中通过 Fastlane 构建 SPM 包不起作用

将 fastlane/gym 与 xcode build 进行比较

如何使用 fastlane 重置特定 Xcode 版本的模拟器?

我的 Xcode 可以构建,但 Fastlane 不行

运行 UI 测试时,Fastlane 扫描“无法合成事件”,适用于 Xcode

Fastlane 与 Xcode 的集成