Cocoapods: 无法找到`Firebase/Core`的规格说明。

33

我的Podfile文件中有以下内容:

pod 'Firebase/Core'
pod 'Firebase/Messaging'

但是出现了这个错误:

[!]找不到 Firebase/Core 的规范

我尝试使用pod 'Firebase',仍然找不到它。

Podfile:

# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'caffetouch manager' do
    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
    pod 'Alamofire', '~> 4.0.0'
    pod 'AlamofireNetworkActivityIndicator', '~> 2.0.1'
    pod 'IQKeyboardManagerSwift', '~> 4.0.6'
    pod 'MZFormSheetPresentationController', '~> 2.4.2'
    pod 'Kingfisher', '~> 3.1.3'
    pod "GMStepper"
    pod 'DKImagePickerController', '~> 3.4.0'
    pod 'Siren', '~> 1.0.2'
    pod 'Eureka', '~> 2.0.0-beta.1'
    pod 'SwiftyJSON'
    pod 'ObjectMapper', '~> 2.1'
    pod 'NVActivityIndicatorView'
    pod 'SwiftDate', '~> 4.0.5'
    pod 'SimpleAlert' '~> 2.0.1'

    pod 'BTNavigationDropdownMenu', :git => 'https://github.com/PhamBaTho/BTNavigationDropdownMenu.git', :branch => 'swift-3.0'
    pod 'ENSwiftSideMenu', :git => 'https://github.com/evnaz/ENSwiftSideMenu.git', :branch => 'master'
    pod 'SkyFloatingLabelTextField', git: "https://github.com/MLSDev/SkyFloatingLabelTextField.git", branch: "swift3"
end


post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

你能否在这里添加你的整个Pod文件以便于我们获得更准确的想法? - Darshan Kunjadiya
更新 @DarshanKunjadiya - Mirza Delic
9个回答

85

尝试更新 Pod 仓库

pod repo update

如果没有帮助,请提供日志记录

pod install --verbose

编辑:

尝试添加

source 'https://github.com/CocoaPods/Specs.git'

将以下内容添加到您的Podfile中。如果无效,则可能存在本地pod repo的问题。您可以使用以下命令进行修复:

pod repo remove master
pod setup
pod install

天才 - 最后一组指令解决了这个问题。可能与Unity尝试在我有机会之前设置Pods有关。 - fionbio
我也遇到了这种情况,通过删除 PodsPodfile.lock 然后重新运行 pod install 来解决了它。 - JaredH
有时候这样做会有帮助。如果你移除 Pods 文件夹和 Podfile.lock 文件,也可以移除 workspace 文件。它会再次生成。 - Piotr Labunski
不要翻译此内容,因为它是粗俗和不适当的。 - A. Trejo
如何在终端中添加源代码? - Siva
@Siva,“在终端中添加源代码”是什么意思? - Piotr Labunski

4

尝试以下命令:

pod repo remove master
pod repo update
pod install --verbose

4

尝试删除文件 podfile.lock
这将有助于解决以下问题:

[!] CocoaPods 无法找到 pod "Firebase/Core" 的兼容版本:
在快照 (Podfile.lock) 中:
Firebase/Core (= 4.8.1)


你能否解释一下删除锁定文件的作用是什么?这样做会有任何副作用吗? - Alexander
删除 Pod 锁定文件可能会破坏项目并造成灾难性后果,因为较新版本的 Pods 可能已经发生了更改。这需要对每个更新的 Pod 进行适当的迁移。 - Aamir

3

我通过更新cocoapods和我的pod存储库解决了这个问题:

sudo gem install cocoapods
pod repo update

3

请检查您的Podfile是否像这样,并执行pod install

platform :ios, '10.0'
use_frameworks!

target '<YOUR APP TARGET>' do

  # Firebase
  pod 'Firebase'
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

我已经更新了我的podfile,并尝试使用您的解决方案,但仍然无法找到Firebase。 - Mirza Delic

2
如果仍然无法正常工作,请删除cocoapods目录rm -rf ~/.cocoapods,然后使用pod setup重新设置cocoapods。

希望这有所帮助。


是的。如果你的Cocoapod Git仓库有问题,这个方法可以解决。因为我的仓库一直没有更新。 - ajpaul

2

我尝试了之前提到的所有方法,但都没有成功。以下是我如何让它工作的方法:

  1. 在你的Podfile中注释掉所有的pods。
  2. 逐个取消注释并在每个注释后运行pod install
  3. 清理并运行。

希望这能帮助到某些人。


1
我遇到了同样的问题。 对我真正起作用的是gem uninstall cocoapods,我发现我有11个cocoapods版本。我选择卸载所有版本,然后gem install cocoapods:1.4.0 现在一切都好了。

0

你好,如果你正在使用Unity并尝试在iOS上运行,请注意我刚刚删除了这一行。

source 'https://github.com/CocoaPods/Specs.git'

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接