4

对于我创建的 pod,cocoapod 将 org.cocoapods 设置为我的 pod 包标识符的前缀:

在此处输入图像描述

我希望能够设置自己的前缀,但我没有在 podspec 中找到任何选项来执行此操作。

有谁知道这个选项是否存在?

问候。塞巴斯蒂安。

4

5 回答 5

1

You can provide your own plist file for your development pod, like this:

s.pod_target_xcconfig = {
  'INFOPLIST_FILE' => '${PODS_TARGET_SRCROOT}/Resources/YourPod-Info.plist'
}

Then you just need to just to change Bundle identifier inside of that plist.

于 2019-06-03T11:42:53.343 回答
1

你需要同时提供

s.info_plist = { 'CFBundleIdentifier' => 'com.myorg.mylib' }

s.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER': 'com.myorg.mylib' }

于 2020-06-11T06:47:10.503 回答
0

有一个简单的方法可以从这个答案中做到这一点

Info.plist DSL 将包含在 1.8.0 版本中。

要设置捆绑标识符:

# in .podspec
s.info_plist = {
  'CFBundleIdentifier' => 'com.myorg.mylib'
}

当前的 Cocoapods 版本是 1.8.0 beta2。我刚试过这个版本,它可以工作。但是如果你使用“pod trunk push”,就会出现一些错误信息“The Pod Specification没有通过验证”。也许我们需要等到 1.8.0 版本发布。

于 2019-09-11T02:06:32.710 回答
0

一种可能的解决方法是使用 post_install 处理程序。这是一个示例脚本:

post_install do |installer|

  installer.project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.name == 'BREnterprise'
        config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution: The Carter Group LLC'
        config.build_settings['PROVISIONING_PROFILE'] = '${BR_ENTERPRISE_PROVISIONING_PROFILE}'
      end
    end
  end

  # change bundle id of each pod to 'com.bottlerocketapps.*'
  bundle_id = 'com.bottlerocketapps'

  directory = installer.config.project_pods_root + 'Target Support Files/'
  Dir.foreach(directory) do |path|

    full_path = directory + path
    if File.directory?(full_path)

      info_plist_path = full_path + 'Info.plist'
      if File.exist?(info_plist_path)

        text = File.read(info_plist_path)
        new_contents = text.gsub('org.cocoapods', bundle_id)
        File.open(info_plist_path, "w") {|file| file.puts new_contents }
      end
    end
  end
end
于 2016-06-03T08:27:58.117 回答
0

迄今为止,此选项不存在:https ://github.com/CocoaPods/CocoaPods/issues/4632#issuecomment-162531257

问候。塞巴斯蒂安。

于 2015-12-07T15:27:25.980 回答