简体   繁体   English

将Cocoapods添加到多个目标

[英]Adding Cocoapods To Multiple Targets

I'm needing to add Alamofire to my main iOS app and the iOS Today Extention. 我需要将Alamofire添加到我的主iOS应用程序和iOS Today Extention中。 With Alamofire just being in my iOS app target, it works great! Alamofire只是在我的iOS应用程序目标中,它的效果非常好! But now, I'm trying to add Alamofire to my today extention. 但是现在,我正试图将Alamofire添加到我今天的扩展中。 This is my Podfile 这是我的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

Whenever using pod install in terminal, I get this: 每当在终端中使用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.

How do I properly do this? 我该如何正确地做到这一点?

UPDATE - Still Not Working 更新 - 仍然无法正常工作

Some information that you may need is that I'm on cocoapods version 1.2.0 and I've tried pod update , but I'm still getting that error 您可能需要的一些信息是我在cocoapods版本1.2.0上我尝试过pod update ,但我仍然遇到了这个错误

[!] The 'Pods-iFunnyVlogger' target has frameworks with conflicting names: alamofire. [!]'Pods-iFunnyVlogger'目标的框架名称相互冲突:alamofire。

Try this 试试这个

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM