安装Pod后,Pod / Header为空 [英] Pods/Headers empty after pod install

查看:371
本文介绍了安装Pod后,Pod / Header为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的 pod安装中,我曾经在我的项目(完全正常工作的项目)中拥有一组功能齐全的Pods。 c $ c>运行,现在我在桥接标头中提到的标头出现找不到文件错误(这是一个包含Obj-C的Swift项目)。经过研究后,似乎应该在 Pods / Headers 中有指向标题的符号链接,该目录对我来说是空的。但是,吊舱本身已经下载,并且所有相应的 Pods / [Lib] 目录都已存在。

I used to have a functional set of Pods in my project (fully working project) until the latest pod install run, now I'm getting "file not found" errors for the headers mentioned in my bridging header (this is a Swift project with Obj-C includes). After doing some research, it seemed like there should be symlinks to the headers in Pods/Headers, that directory is empty for me. However, the pods themselves have been downloaded and all corresponding Pods/[Lib] directories exist.

在此错误开始发生之前我所做的更改是指定:git :commit 标记我要导入的其中一个库。然后重新运行 pod install 并开始看到找不到文件错误。当时我正在使用Cocoapods 0.39

What I've changed right before this error started occurring was specifying :git and :commit flags for one of the libraries I was pulling in. I then reran pod install and started seeing "file not found" errors. At the time I was using Cocoapods 0.39

我尝试了其他堆栈中的一些解决方案溢出线程,包括添加用户头搜索路径(没有任何效果(现在恢复为原始状态)),以及更新我的cocoapods。我当前的cocoapods版本现在是1.0.0.beta.6。除了我遇到的其他麻烦之外,例如不得不重写我的Podfile的某些部分以符合新的标准,现在我似乎又回到了相同的状态(所有库都已成功下载,但找不到标头)。

I've tried a few solutions from other stack overflow threads, including adding User Header Search Paths, which had no effect (now back to original), and updating my cocoapods. My current version of cocoapods is now 1.0.0.beta.6. Aside from additional headaches I experienced such as having to rewrite parts of my Podfile to be compliant with new standards, I now seem to be back to the same state (with all libraries successfully downloading, but headers failing to be found).

以下是我如何在桥接标题中包含标题的示例:

Here is an example of how I'm including my headers in the bridging header:

// In this header, you should import all the public headers of your framework using statements like #import <MyKit/PublicHeader.h>
#import <CocoaLumberjack/CocoaLumberjack.h>

这是我的Podfile的样子(我尝试将其缩小以免产生无关的内容):

And here is what my Podfile looks like (I've tried to slim it down to avoid irrelevant content):

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

use_frameworks!
pod 'CocoaLumberjack', '2.0.0'
pod 'SwiftyJSON', '~> 2.3'
pod 'Classy', :git => 'https://github.com/ClassyKit/Classy.git', :commit => 'c319908f8bded62e268dfd48ee5d65329b819129'

workspace 'my.work-ios'
project 'mywork' # sdk
project 'Examples/example1' # sample project using sdk
project 'my.work-ios.xcodeproj' # placeholder for main project, not really in use

target 'UnitTests' do
  pod 'Specta'
  pod 'Expecta'
  pod 'OCMock'
  pod 'OHHTTPStubs'
end

# Copy acknowledgements to the Settings.bundle
post_install do | installer |
  require 'fileutils'

  pods_acknowledgements_path = 'Pods/Target Support Files/Pods/Pods-Acknowledgements.plist'
  settings_bundle_path = Dir.glob("**/*Settings.bundle*").first

  if File.file?(pods_acknowledgements_path)
    puts 'Copying acknowledgements to Settings.bundle'
    FileUtils.cp_r(pods_acknowledgements_path, "#{settings_bundle_path}/Acknowledgements.plist", :remove_destination => true)
  end

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['OTHER_SWIFT_FLAGS'] = "-DLEGACY"
    end
  end
end



更新



经过更多挖掘后,我发现罪魁祸首是 use_frameworks!命令,省略该命令(并依次删除Swift库,因为它们是必需的),导致 Pods / Headers 填充为 Private 公共目录,以及相关标题的符号链接。

Update

After some more digging, I discovered that the culprit is use_frameworks! command, omitting it (and in turn removing Swift libraries, because it's required for them) causes Pods/Headers to be populated with Private and Public directories, along with symlinks for the relevant headers.

在以前版本的cocoapods的情况下,我仍在尝试了解发生了什么,因为忽略该命令对我来说不是一个可行的解决方法(考虑到我在应用程序中使用的Swift库)。

This was not the case in previous version of cocoapods, and I'm still trying to understand what's happening, because omitting that command is not a usable workaround for me (given the Swift libraries I use in my app).

这已在注释中提及,但为方便起见,我也将其放在此处。这似乎是由以下线程中报告的错误引起的: https://github.com。 com / CocoaPods / CocoaPods / issues / 4605#issuecomment-208822149 。该主题还提出了一些可能对某些人来说足够好的解决方法。对我来说,不是,所以我回到了0.39。

This is already mentioned in the comments, but for convenience I'm putting this here as well. This seems to be caused by a bug reported in this thread: https://github.com/CocoaPods/CocoaPods/issues/4605#issuecomment-208822149. The thread also suggests a few workarounds that may be good enough for some. For me, they were not, so I went back to 0.39.

推荐答案

您是否尝试过此设置?

target 'TargetProject' do

    pod 'CocoaLumberjack', '2.0.0'
    pod 'SwiftyJSON', '~> 2.3'
    pod 'Classy', :git => 'https://github.com/ClassyKit/Classy.git', :commit     => 'c319908f8bded62e268dfd48ee5d65329b819129'

end




并有此 .swift-version添加了吗?其中包含
'3.0-GM-CANDIDATE'

and have this '.swift-version' added? where it contains '3.0-GM-CANDIDATE'

我正在为Swift 3.0使用这种设置

I'm using this kind of settings for swift 3.0

这篇关于安装Pod后,Pod / Header为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆