gpt4 book ai didi

ios - 将 Cocoapods 添加到多个目标

转载 作者:搜寻专家 更新时间:2023-10-31 22:11:02 24 4
gpt4 key购买 nike

我需要将 Alamofire 添加到我的主要 iOS 应用程序和 iOS Today Extention。 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

每当在终端中使用 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.

我该如何正确执行此操作?

更新 - 仍然无法正常工作

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

[!] The 'Pods-iFunnyVlogger' target has frameworks with conflicting names: alamofire.

最佳答案

试试这个

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

关于ios - 将 Cocoapods 添加到多个目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45437477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com