如何通过不同的项目和目标使用Cocoapods

How to use Cocoapods through different projects and targets

我有一个 Xcode 工作区,其中包含项目 ABC。项目 A 有目标 AAAB,项目 BC 各只有一个目标(这是项目的名称)。

如何为每个目标指定不同的 pods,以及其中几个目标共有的一些 pods?

我尝试了与 here 类似的操作,但出现此错误:

"[!] Invalid Podfile file: undefined method `inherit!' for #. Updating CocoaPods might fix the issue."

我正在使用 Cocoapods 0.39.0.

我将 def 用于共享:

def import_shared_pods
    # Shared pods follow:
end


target 'Target' do
    platform :ios, '7.0'
    import_shared_pods

    # Target pods follow:
end

参考: https://www.natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/