iOS组件化话外篇:Podfile 工程配置

cocoaPods

Posted by PaysonChen on March 6, 2024

1、cocopaods生成 组织信息

​ 模板修改

​ podfile新增:

1
2
3
post_install do |installer|
    installer.pods_project.root_object.attributes["ORGANIZATIONNAME"] = "YOUR ORGANIZATIONNAME"
end

在执行

1
pod install

之后,工程项目的“ORGANIZATIONNAME”的字段自动填充你所要的值:

1

2、主工程签名

1
2
3
4
5
6
7
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["DEVELOPMENT_TEAM"] = "xxxxx"  #这里指定签名,避免编译出错还要手动指定
    end
  end
end

3、其他参数配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
post_install do |installer|
  installer.pods_project.root_object.attributes["ORGANIZATIONNAME"] = "YOUR ORGANIZATIONNAME"
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'	#设置最低iOS版本
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"	#支持M系列模拟器
      
			config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"# 解决xcode14 运行报错运行遇到的报错 “error: Signing for “XX” requires a development team.”
			config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
      config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
      
      config.build_settings["DEVELOPMENT_TEAM"] = "xxxx"  #这里指定签名,避免编译出错还要手动指定
    end
  end
end