【问题标题】:Code signing an app built with fastlane and CocoaPods built as dynamic frameworks对使用 fastlane 和作为动态框架构建的 CocoaPods 构建的应用程序进行代码签名
【发布时间】:2015-08-18 04:20:40
【问题描述】:

我有一个相当正常的 fastlane 和 CocoaPods 设置,但由于 fastlane 尝试使用应用程序的配置文件对每个 CocoaPod 进行签名,因此代码签名存在问题。它失败并出现此错误:

[03:21:05]: [SHELL COMMAND]: set -o pipefail && krausefx-ipa build -w "MyApp.xcworkspace" -c "Release" -s "MyApp" --xcargs "PROVISIONING_PROFILE=g7ba10c8-cddd-490e-8eab-7ef35a511565 PRODUCT_BUNDLE_IDENTIFIER=com.example.MyApp" --no-clean --archive -d "/Users/app/Deployment" --ipa "MyApp.ipa" -m "/Users/app/Deployment/MyApp-distribution.mobileprovision" --verbose | xcpretty
[03:21:07]: [SHELL]: ▸ Building Pods/CocoaLumberjack [Release]
[03:21:07]: [SHELL]: 
[03:21:07]: [SHELL]: ⌦  Code Sign error: Provisioning profile does not match bundle identifier: The provisioning profile specified in your build settings (“com.example.MyApp Distribution”) has an AppID of “com.example.MyApp” which does not match your bundle identifier “org.cocoapods.CocoaLumberjack”.
...
[03:21:08]: [SHELL]: ** ARCHIVE FAILED **
[03:21:08]: [SHELL]: 
[03:21:08]: [SHELL]: 
[03:21:08]: [SHELL]: The following build commands failed:
[03:21:08]: [SHELL]: Check dependencies
[03:21:08]: [SHELL]: Check dependencies
[03:21:08]: [SHELL]: (2 failures)

有没有办法告诉 ipa/shenzhen 不要签署 CocoaPods?


CocoaPods 是作为动态框架构建的。这是 Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'CocoaLumberjack', '2.0.0'
pod 'HexColors', '~> 2.3'

这是快速文件:

require 'fileutils'
require 'shellwords'

fastlane_version "1.12.0"

default_platform :ios

output_directory = File.expand_path('../Deployment')

platform :ios do

  before_all do
    FileUtils.mkdir_p(output_directory)
  end

  lane :production do
    sigh(
      output_path: output_directory,
      filename: "MyApp-distribution.mobileprovision",
    )

    xcodebuild_args = {
      PROVISIONING_PROFILE: Actions.lane_context[Actions::SharedValues::SIGH_UDID],
      PRODUCT_BUNDLE_IDENTIFIER: "com.example.MyApp",
    }
    xcodebuild_args = xcodebuild_args.map do |k,v|
      "#{k.to_s.shellescape}=#{v.shellescape}"
    end.join ' '

    ipa(
      workspace: "MyApp.xcworkspace",
      configuration: "Release",
      scheme: "MyApp",
      xcargs: xcodebuild_args,
      clean: false,
      archive: true,
      destination: output_directory,
      ipa: "MyApp.ipa",
    )
  end
end

【问题讨论】:

    标签: ios cocoapods code-signing ios-frameworks fastlane


    【解决方案1】:

    使用自定义环境变量而不是 PROVISIONING_PROFILE 可以解决此问题。 the fastlane docs about code signing 中描述了这种技术。

    这些是适用于 Xcode 6 的步骤:

    向您的 Xcode 项目添加自定义变量

    在您的 Xcode pbxproj 文件中,将 PROVISIONING_PROFILE 的值设置为另一个变量,例如 $(APP_PROVISIONING_PROFILE)。您可以选择任何您喜欢的独特的自定义变量。项目的代码签名部分应如下所示:

    在您的 Fastfile 中定义自定义变量

    在您的 Fastfile 中,定义自定义变量并将其与其他 xcargs 一起传递给 ipa 操作。在问题的示例代码中,如下所示:

    xcodebuild_args = {
      # Define the custom variable instead of PROVISIONING_PROFILE
      APP_PROVISIONING_PROFILE: Actions.lane_context[Actions::SharedValues::SIGH_UDID],
      PRODUCT_BUNDLE_IDENTIFIER: "com.example.MyApp",
    }
    

    这就是修复这个特定错误的全部内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-18
      • 1970-01-01
      • 2017-05-08
      • 1970-01-01
      相关资源
      最近更新 更多