Cocoapods - 无法找到[Github框架]的规范

时间:2021-03-08 17:32:58

When trying to pod install a new Podfile into an existing Xcode (iOS) project, I get the following error message from Terminal: [!] Unable to find a specification for 'XCDYouTubeKit (~> 2.1.1)'. The Podfile that I was trying to load looks like this:

当尝试将新的Podfile安装到现有的Xcode(iOS)项目中时,我从终端收到以下错误消息:[!]无法找到'XCDYouTubeKit(〜> 2.1.1)'的规范。我尝试加载的Podfile如下所示:

# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'

target 'DemoApp' do

pod 'XCDYouTubeKit', '~> 2.1.1'

end

target 'DemoAppTests' do

end

target 'TheDayByDay' do

end

Additionally, the file structure for my Xcode project is as follows:

另外,我的Xcode项目的文件结构如下:

DemoApp
     Podfile (file)
     Pods (directory)
     DemoApp (directory)
     DemoApp.xcodeproj (file)
     DemoAppTests (directory)

What about this installation is not working? Where am I going wrong? I'm running Cocoapods 0.35.0. Am I missing a pod spec file? I don't understand what it is or what the file structure of such a file would like.

这个装置怎么样不起作用?我哪里错了?我正在运行Cocoapods 0.35.0。我错过了pod规范文件吗?我不明白它是什么或这样的文件的文件结构是什么样的。

4 个解决方案

#1


32  

Citing your conversation in the comments, you'll want to execute sudo rm -fr ~/.cocoapods/repos/master because it'll remove all the bogus and corrupted repos that you have in your computer to give it a chance to repopulate after you redo pod setup, which'll reinstate you with a fresh Cocoapods setup. Additionally, you'll want to specify sudo xcode-select --switch /applications/Xcode.app where your new version of Xcode is. That was just another setup procedure that I had to do to complete the fix. From there, just do pod setup and you're set to run pod install to integrate all the libraries that you want!

在评论中引用您的对话,您将要执行sudo rm -fr~ / .cocoapods / repos / master,因为它将删除您计算机中的所有虚假和损坏的回购,以使其有机会重新填充你重做pod设置,它将使用新的Cocoapods设置恢复你。此外,您还需要在新版本的Xcode中指定sudo xcode-select --switch /applications/Xcode.app。这只是我必须做的另一个设置过程来完成修复。从那里,只需进行pod设置,然后设置为运行pod install以集成所需的所有库!

#2


5  

You can also force it by setting it like this:

您也可以通过如下设置强制它:

pod 'yourpodframework', :git => 'https://github.com/username/yourpodframework'

pod'yourpodframework',:git =>'https://github.com/username/yourpodframework'

#3


4  

I had the same problem. But I've got to fix my issue with the following procedure.

我有同样的问题。但我必须通过以下程序解决我的问题。

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

    target 'Test' do

      use_frameworks!

#    pod 'Alamofire', '~> 4.0'
     pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'

#    pod 'SwiftyJSON' , '~> 3.1'
     pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

#     pod 'SideMenu' '~> 2.0'
      pod 'SideMenu', :git => 'https://github.com/jonkykong/SideMenu.git'

#     pod 'SDWebImage', '4.0.0-beta2'
      pod 'SDWebImage', :git => 'https://github.com/rs/SDWebImage.git'

#     pod 'SwiftDate', '~> 4.0'
      pod 'SwiftDate', :git => 'https://github.com/malcommac/SwiftDate'



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

Links for more information

链接了解更多信息

#4


1  

I'll put this here for future reference: In my case the problem was a faulty podspec with a syntax issue that had been pushed to a remote. The Podfile contained a reference to a specific github commit. Apparently in this situation CocoaPods give the quite unhelpful error message about "missing podspec" although the podspec is definitely there, only botched.

我将把它放在这里以供将来参考:在我的情况下,问题是一个错误的podspec,其语法问题已被推送到远程。 Podfile包含对特定github提交的引用。显然在这种情况下CocoaPods提供了关于“缺少podspec”的非常无益的错误消息,尽管podspec肯定存在,只是拙劣。

Solution: download the podspec file (e.g. by cloning the entire pod's repo) and run pod spec lint.

解决方案:下载podspec文件(例如,通过克隆整个pod的repo)并运行pod spec lint。

Alternatively: clone the pod locally and change the Podfile reference to a local path. Doing a pod install in this case will show a much more helpful error message. Like this:

或者:在本地克隆pod并将Podfile引用更改为本地路径。在这种情况下执行pod安装将显示更有用的错误消息。像这样:

[!] Invalid `<some>.podspec` file: syntax error, unexpected tCONSTANT, expecting keyword_end
...eGraphics', 'QuartzCore, 'IOKit', 'XCTest'

As you can see, in my case this was a missing quote after QuartzCore

正如您所看到的,在我的情况下,这是QuartzCore之后缺少的引用

#1


32  

Citing your conversation in the comments, you'll want to execute sudo rm -fr ~/.cocoapods/repos/master because it'll remove all the bogus and corrupted repos that you have in your computer to give it a chance to repopulate after you redo pod setup, which'll reinstate you with a fresh Cocoapods setup. Additionally, you'll want to specify sudo xcode-select --switch /applications/Xcode.app where your new version of Xcode is. That was just another setup procedure that I had to do to complete the fix. From there, just do pod setup and you're set to run pod install to integrate all the libraries that you want!

在评论中引用您的对话,您将要执行sudo rm -fr~ / .cocoapods / repos / master,因为它将删除您计算机中的所有虚假和损坏的回购,以使其有机会重新填充你重做pod设置,它将使用新的Cocoapods设置恢复你。此外,您还需要在新版本的Xcode中指定sudo xcode-select --switch /applications/Xcode.app。这只是我必须做的另一个设置过程来完成修复。从那里,只需进行pod设置,然后设置为运行pod install以集成所需的所有库!

#2


5  

You can also force it by setting it like this:

您也可以通过如下设置强制它:

pod 'yourpodframework', :git => 'https://github.com/username/yourpodframework'

pod'yourpodframework',:git =>'https://github.com/username/yourpodframework'

#3


4  

I had the same problem. But I've got to fix my issue with the following procedure.

我有同样的问题。但我必须通过以下程序解决我的问题。

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

    target 'Test' do

      use_frameworks!

#    pod 'Alamofire', '~> 4.0'
     pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'

#    pod 'SwiftyJSON' , '~> 3.1'
     pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

#     pod 'SideMenu' '~> 2.0'
      pod 'SideMenu', :git => 'https://github.com/jonkykong/SideMenu.git'

#     pod 'SDWebImage', '4.0.0-beta2'
      pod 'SDWebImage', :git => 'https://github.com/rs/SDWebImage.git'

#     pod 'SwiftDate', '~> 4.0'
      pod 'SwiftDate', :git => 'https://github.com/malcommac/SwiftDate'



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

Links for more information

链接了解更多信息

#4


1  

I'll put this here for future reference: In my case the problem was a faulty podspec with a syntax issue that had been pushed to a remote. The Podfile contained a reference to a specific github commit. Apparently in this situation CocoaPods give the quite unhelpful error message about "missing podspec" although the podspec is definitely there, only botched.

我将把它放在这里以供将来参考:在我的情况下,问题是一个错误的podspec,其语法问题已被推送到远程。 Podfile包含对特定github提交的引用。显然在这种情况下CocoaPods提供了关于“缺少podspec”的非常无益的错误消息,尽管podspec肯定存在,只是拙劣。

Solution: download the podspec file (e.g. by cloning the entire pod's repo) and run pod spec lint.

解决方案:下载podspec文件(例如,通过克隆整个pod的repo)并运行pod spec lint。

Alternatively: clone the pod locally and change the Podfile reference to a local path. Doing a pod install in this case will show a much more helpful error message. Like this:

或者:在本地克隆pod并将Podfile引用更改为本地路径。在这种情况下执行pod安装将显示更有用的错误消息。像这样:

[!] Invalid `<some>.podspec` file: syntax error, unexpected tCONSTANT, expecting keyword_end
...eGraphics', 'QuartzCore, 'IOKit', 'XCTest'

As you can see, in my case this was a missing quote after QuartzCore

正如您所看到的,在我的情况下,这是QuartzCore之后缺少的引用