Ios 如何在应用程序和扩展中使用cocoapods

Ios 如何在应用程序和扩展中使用cocoapods,ios,xcode,cocoapods,podfile,Ios,Xcode,Cocoapods,Podfile,我想在主应用程序及其扩展程序中使用一些库。我尝试了这个podfile platform :ios, '10.2' use_frameworks! target 'myApp' do target 'myAppShareExtension' do pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git' pod

我想在主应用程序及其扩展程序中使用一些库。我尝试了这个
podfile

platform :ios, '10.2'
use_frameworks!
target 'myApp' do
       target 'myAppShareExtension' do
                pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
                pod 'Alamofire', '~> 4.0'
                pod 'FileKit', '~> 4.0.1'
       end
end
但是我的
目标支持文件
名为
Pods myApp myAppShareExtension
,而它应该是
Pods myAppShareExtension
,这让我觉得问题来自pod文件

谢谢。

你可以试试这个:

为多个目标共享POD的最佳方式:

def shared_pods
            pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
            pod 'Alamofire', '~> 4.0'
            pod 'FileKit', '~> 4.0.1'

end

target 'myApp' do
    shared_pods
end

target 'myAppShareExtension' do
    shared_pods
end

谢谢但是它退出时带有
目标“Pods myapp”的框架名称冲突:alamofire、filekit和svprogresshud。
请从项目中删除pod,创建新的pod文件并安装pod。要从您的项目中删除pod,请参见以下内容:确实如此,但问题相同。我想知道这是否与cocoapods 1.2的bug无关。请看这一个,也在GitHub上提到: