You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode14.2打包时GoogleSignIn SDK签名失败,求兼容Xcode13的方案

解决Xcode14.2打包GoogleSignIn签名问题且兼容Xcode13

方法1:通过Podfile脚本适配不同Xcode版本

在项目的Podfile中添加以下代码,仅针对Xcode14及以上版本自动配置GoogleSignIn的签名信息,Xcode13环境下不会生效:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    next unless target.name == 'GoogleSignIn'
    
    if Gem::Version.new(Xcode.version) >= Gem::Version.new('14.0')
      target.build_configurations.each do |config|
        # 替换为你的开发团队ID
        config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_TEAM_ID'
        # 开启自动签名(可选,根据项目需求调整)
        config.build_settings['CODE_SIGN_STYLE'] = 'Automatic'
      end
    end
  end
end

修改完成后执行pod install,重新安装依赖即可。

方法2:使用xcconfig条件配置文件

  1. 新建两个配置文件:Xcode13-Config.xcconfig和Xcode14-Config.xcconfig
  2. 在Xcode14-Config.xcconfig中添加签名配置:
DEVELOPMENT_TEAM = YOUR_TEAM_ID
CODE_SIGN_STYLE = Automatic
  1. 打开项目的Build Settings,Xcode13环境下选择Xcode13-Config.xcconfig(保持原有配置即可),Xcode14及以上环境选择Xcode14-Config.xcconfig
  2. 确保GoogleSignIn的target继承项目配置,可在Podfile中设置inherit! :complete保证配置继承

方法3:手动修改后通过Podfile锁定配置

先在Xcode中打开Pods项目,找到GoogleSignIn target,在Signing & Capabilities中选择开发团队。之后在Podfile中添加以下脚本,防止后续pod install或pod update覆盖你的修改:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    next unless target.name == 'GoogleSignIn'
    
    if Gem::Version.new(Xcode.version) >= Gem::Version.new('14.0')
      target.build_configurations.each do |config|
        config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_TEAM_ID'
        config.build_settings['CODE_SIGN_STYLE'] = 'Automatic'
      end
    end
  end
end

关键注意点

  • 替换YOUR_TEAM_ID为你实际的开发团队ID,可在Xcode的Signing & Capabilities面板中查看
  • 所有方法都保证Xcode13环境下的构建流程不受影响
  • 每次执行Pod相关命令后,脚本会自动适配对应Xcode版本的配置

内容的提问来源于stack exchange,提问作者user20220623

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 10:20:11