2

最近我的 Xcode iOS8+ iPhone 项目由于 UIButton+AFNetworking.h 中的文件未找到错误而停止构建。

错误读取“AFImageDownloader.h”文件未找到。

查看 finder 中的文件夹,在查看 AFNetworking 的 Git 存储库时,它缺少一半应该存在的文件。因此,当神奇地添加该文件时,它可能会失败更多。

互联网上的所有解决方案都失败了。我试过: - 从 MacBook(El Capitan)中完全删除 CocoaPods、它的缓存和主存储库 - Pod 安装/更新 --no-clean - 所有类型的命令我都记不得了。- 删除本地 Git,重新安装并重新克隆 repo。

当我的同事在他的 MacBook 上安装该项目时,它的安装和构建都很好。

    platform :ios, '8.0'
    inhibit_all_warnings!

target "censored" do
pod 'BDGShare'
pod 'BDGMacros'
pod 'BDGLocation'
pod 'BDGCategories'
pod 'BDGScreenshot'
pod 'BDGImagePicker'

pod 'Lockbox'
pod 'HockeySDK'
pod 'DTCoreText'
pod 'AFNetworking'
pod 'SVProgressHUD'
pod 'DZNEmptyDataSet'
pod 'Google/Analytics'
pod 'TTTAttributedLabel'
pod 'iOS-htmltopdf', '~> 1.0'

end

pod install verbose 给了我这个

pod install --verbose
  Preparing

Updating local specs repositories

Updating spec repo `master`
  $ /usr/bin/git pull --ff-only
  Already up-to-date.

CocoaPods 1.0.0.beta.6 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.


Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods`: (``)
  Using `ARCHS` setting to build architectures of target `Pods-Censored`: (``)

Resolving dependencies of `Podfile`

Comparing resolved specification to the sandbox manifest
  - AFNetworking
  - BDGCategories
  - BDGImagePicker
  - BDGLocation
  - BDGMacros
  - BDGScreenshot
  - BDGShare
  - DTCoreText
  - DTFoundation
  - DZNEmptyDataSet
  - Google
  - GoogleAnalytics
  - GoogleInterchangeUtilities
  - GoogleNetworkingUtilities
  - GoogleSymbolUtilities
  - GoogleUtilities
  - HockeySDK
  - Lockbox
  - SVProgressHUD
  - TTTAttributedLabel
  - iOS-htmltopdf

Downloading dependencies

-> Using AFNetworking (3.0.4)

-> Using BDGCategories (0.0.8)

-> Using BDGImagePicker (0.0.6)

-> Using BDGLocation (0.0.2)

-> Using BDGMacros (0.0.14)

-> Using BDGScreenshot (0.0.2)

-> Using BDGShare (0.0.9)

-> Using DTCoreText (1.6.17)

-> Using DTFoundation (1.7.9)

-> Using DZNEmptyDataSet (1.7.3)

-> Using Google (1.3.2)

-> Using GoogleAnalytics (3.14.0)

-> Using GoogleInterchangeUtilities (1.1.0)

-> Using GoogleNetworkingUtilities (1.0.0)

-> Using GoogleSymbolUtilities (1.0.3)

-> Using GoogleUtilities (1.1.0)

-> Using HockeySDK (3.8.6)

-> Using Lockbox (3.0.0)

-> Using SVProgressHUD (1.1.3)

-> Using TTTAttributedLabel (1.13.4)

-> Using iOS-htmltopdf (1.0.3)
  - Running pre install hooks

Generating Pods project
  - Creating Pods project
  - Adding source files to Pods project
  - Adding frameworks to Pods project
  - Adding libraries to Pods project
  - Adding resources to Pods project
  - Linking headers
  - Installing targets
    - Installing target `AFNetworking` iOS 8.0
    - Installing target `BDGCategories` iOS 8.0
    - Installing target `BDGImagePicker` iOS 8.0
    - Installing target `BDGLocation` iOS 8.0
    - Installing target `BDGScreenshot` iOS 8.0
    - Installing target `BDGShare` iOS 8.0
    - Installing target `DTCoreText` iOS 8.0
    - Installing target `DTFoundation` iOS 8.0
    - Installing target `DZNEmptyDataSet` iOS 8.0
    - Installing target `Lockbox` iOS 8.0
    - Installing target `SVProgressHUD` iOS 8.0
    - Installing target `TTTAttributedLabel` iOS 8.0
    - Installing target `iOS-htmltopdf` iOS 8.0
    - Installing target `Pods-Censored` iOS 8.0
  - Running post install hooks
  - Writing Xcode project file to `Pods/Pods.xcodeproj`
    - Generating deterministic UUIDs
  - Writing Lockfile in `Podfile.lock`
  - Writing Manifest in `Pods/Manifest.lock`

Integrating client project

Integrating target `Pods-Censored` (`Censored.xcodeproj` project)
  - Running post install hooks
    - cocoapods-stats from
    `/Library/Ruby/Gems/2.0.0/gems/cocoapods-stats-0.6.2/lib/cocoapods_plugin.rb`

Sending stats
      - AFNetworking, 3.0.4
      - BDGCategories, 0.0.8
      - BDGImagePicker, 0.0.6
      - BDGLocation, 0.0.2
      - BDGMacros, 0.0.14
      - BDGScreenshot, 0.0.2
      - BDGShare, 0.0.9
      - DTCoreText, 1.6.17
      - DTFoundation, 1.7.9
      - DZNEmptyDataSet, 1.7.3
      - Google, 1.3.2
      - GoogleAnalytics, 3.14.0
      - GoogleInterchangeUtilities, 1.1.0
      - GoogleNetworkingUtilities, 1.0.0
      - GoogleSymbolUtilities, 1.0.3
      - GoogleUtilities, 1.1.0
      - HockeySDK, 3.8.6
      - Lockbox, 3.0.0
      - SVProgressHUD, 1.1.3
      - TTTAttributedLabel, 1.13.4
      - iOS-htmltopdf, 1.0.3
  Pod installation complete! There are 15 dependencies from the Podfile and 21
  total pods installed.
4

1 回答 1

0

我不确定这个解决方案是否会特别适用,但我试过了,它奏效了:

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

本质上是删除 CocoaPods 的缓存,然后是 Pods 文件,然后重新安装。

来源:https ://gist.github.com/mbinna/4202236

于 2019-03-06T03:44:36.600 回答