简体   繁体   中英

Xcode and Cocoapods “No such module” error

I recently upgraded to Xcode 8 and an existing project to Swift 3. After having a variety of issues with Cocoapods, I decided to start over from scratch. After running pod deintegrate and deleting Podfile , Podfile.lock , and [Project].xcworkspace , I had a blank slate as far as Cocoapods was concerned.

I then took the following actions:

  1. Opened a terminal at the project location and ran pod init , then pod install (using the stub Podfile that pod init creates).

    This appeared to be successful, but came with the following two warnings:

[!] 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.

At this point, opening Xcode and building the project gives the "No such module" error, which is entirely expected.

Following the instructions at this question solves this problem and rerunning pod install is a success.

  1. Closed Xcode, added the modules I'm using to the Podfile (see below), the ran pod install again. According to the terminal output, this is successful.

  2. Opened Xcode and built the project. I again receive the "No such module" error, specifically No such module 'ReactiveCocoa'

    I have confirmed that the same problem occurs with SnapKit, Hue, KMPlaceholderTextView, KeychainSwift, and Siren, depending on the order of the import statements. For some reason, none of the Google modules are affected by this problem.

My 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

Make sure you are opening .xcworkspace and not .xcodeproj file.

You may further look into this post .

Also under : Target > General > Linked Frameworks and Libraries Make sure your frameworks are there. Even Pods_Xena.framework is there

Try:

Xcode ->Preferences ->Location ->DerivedData

open the folder DerivedData and move it to Trash

Uncomment the next line to define a global platform for your project

platform :iOS, '9.0'

Uncommenting the second line in your pod file will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM