将可可足目添加到多个目标

Jac*_*vin 3 ios cocoapods swift alamofire

我需要将Alamofire添加到我的主要iOS应用和iOS Today Extension中。Alamofire只是我的iOS应用目标,因此效果很好!但是现在,我正在尝试将Alamofire添加到我今天的扩展中。这是我的Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'The Main iOS App' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

pod 'Canvas'
pod 'Firebase/Core’
pod 'Firebase/Messaging’
pod 'Alamofire', '~> 4.4'

  # Pods for The Main iOS App

end

target 'Today' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  pod 'Alamofire', '~> 4.4'

  # Pods for Today

end
Run Code Online (Sandbox Code Playgroud)

每当pod install在终端中使用时,我都会得到:

Analyzing dependencies
Downloading dependencies
Using Alamofire (4.5.0)
Using Canvas (0.1.2)
Using Firebase (4.0.3)
Using FirebaseAnalytics (4.0.2)
Using FirebaseCore (4.0.3)
Using FirebaseInstanceID (2.0.0)
Using FirebaseMessaging (2.0.0)
Using GoogleToolboxForMac (2.1.1)
Using Protobuf (3.3.0)
[!] The 'Pods-iFunnyVlogger' target has frameworks with conflicting names: alamofire.
Run Code Online (Sandbox Code Playgroud)

如何正确执行此操作?

更新-仍然无法正常工作

您可能需要的一些信息是,我正在使用cocoapods版本1.2.0,并且已经尝试过pod update,但是仍然遇到该错误。

[!]“ Pods-iFunnyVlogger”目标具有名称冲突的框架:alamofire。

Joe*_*Joe 5

尝试这个

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

def other_pods
    pod 'Canvas'
    pod 'Firebase/Core’
    pod 'Firebase/Messaging’
end    

def shared_pods
    pod 'Alamofire', '~> 4.4'
end

target 'The Main iOS App' do
    shared_pods
    other_pods
end

target 'Today' do
    shared_pods
end
Run Code Online (Sandbox Code Playgroud)