簡體   English   中英

Xcode和Cocoapods“沒有這樣的模塊”錯誤

[英]Xcode and Cocoapods “No such module” error

我最近升級到Xcode 8和現有項目到Swift 3.在與Cocoapods有各種各樣的問題后,我決定從頭開始。 在運行pod deintegrate並刪除PodfilePodfile.lock[Project].xcworkspace ,就[Project].xcworkspace ,我有一個空白的名單。

然后我采取了以下行動:

  1. 在項目位置打開終端並運行pod init ,然后執行pod install (使用pod init創建的存根Podfile)。

    這似乎是成功的,但附帶以下兩個警告:

[!] The `Xena [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Xena/Pods-Xena.debug.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target.

[!] The `Xena [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Xena/Pods-Xena.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target.

此時,打開Xcode並構建項目會產生“No such module”錯誤,這是完全可以預料到的。

按照此問題的說明解決此問題並重新運行pod install是成功的。

  1. 關閉Xcode,將我正在使用的模塊添加到Podfile(見下文),再次運行pod install 根據終端輸出,這是成功的。

  2. 打開Xcode並構建項目。 我再次收到“No such module”錯誤,特別是No such module 'ReactiveCocoa'

    我已經確認SnapKit,Hue,KMPlaceholderTextView,KeychainSwift和Siren會出​​現同樣的問題,具體取決於import語句的順序。 出於某種原因,沒有任何Google模塊受此問題的影響。

我的Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Xena' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Xena
  pod 'ReactiveCocoa', :git => 'https://github.com/ReactiveCocoa/ReactiveCocoa.git'
  pod 'SnapKit', '~> 3.0.2'
  pod 'Hue', '~> 2.0.1'
  pod 'KMPlaceholderTextView', '~> 1.3.0'
  pod 'GooglePlacePicker'
  pod 'GooglePlaces'
  pod 'GoogleMaps'
  pod 'KeychainSwift', '~> 7.0'
  pod 'Siren'

  target 'XenaTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'XenaUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

確保打開.xcworkspace而不是.xcodeproj文件。

你可以進一步研究這篇文章

同樣位於:Target> General> Linked Frameworks and Libraries確保您的框架在那里。 甚至還有Pods_Xena.framework

嘗試:

Xcode - >首選項 - >位置 - > DerivedData

打開DerivedData文件夾並將其移至“廢紙簍”

取消注釋下一行以定義項目的全局平台

platform :iOS, '9.0'

取消注釋pod文件中的第二行將對您有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM