Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

ios - No such module ... in Xcode

I've run into a problem with Xcode (using Swift) that has me completely stumped. I realize that this question has been asked and answered, but none of the answers have worked for me, and my situation seems to be a bit different than the others, as all of my pods are failing (not just a specific one). They all worked fine a week ago.

I use Cocoapods for some of the more common Swift frameworks (e.g. Alamofire, Eureka, Kingfisher, SwiftyJSON, etc.). They were all working fine in Xcode 7. However, one of the (automatic) updates bumped up my Xcode version, after which it became mandatory to specify your target in the podfile. I did this and ran pod install. The pods are all still there, but now every import statement that relates to these frameworks fails.

At first I thought it was an Alamofire issue, as that's the first one that failed with the "No such module 'Alamofire'" error. I tried everything I could with Alamofire, including the following:

  • Clean and rebuild
  • Clean build folder
  • Restart Xcode
  • Re-boot computer
  • Delete all derived data
  • Added framework to "Linked Frameworks and Libraries"
  • Added framework to "Link Binary with Libraries"
  • Verified that I am opening the workspace rather than the project
  • Re-installed CocoaPods
  • Re-installed Xcode ver 7.3.1

Nothing would remove the "No such module ..." error. Finally, I removed Alamofire from the pods and just dragged the Alamofire project into my project. This allowed me to remove the import statements for Alamofire. However, to my dismay, now the next framework caused "No such module". I moved the next three frameworks into my project, and it looks like it is just going to keep going. Apparently, none of my Pods frameworks are being recognized anymore. I installed Xcode 8 and tried that with Swift 2.3, but I get the same "No such module" errors.

I really would prefer to use Cocoapods, as it makes upgrades a lot easier, along with other bonuses. I'm guessing I have some setting wrong that is screwing up all my pods, but have not had any luck finding it. This is a bit of a disaster as it has shut down development for several days, with no sign of a fix. If there is anything I can do or provide to assist in finding a solution, just let me know. If anyone could provide any possible solutions or even things to try, it would be greatly appreciated. I'm currently working with Xcode version 7.3.1.

My pod file looks something like this:

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

target 'Y2GOsp' do
    use_frameworks!

    # Pods for Y2GOsp
    pod 'Alamofire', '~> 3.0'
    pod 'AlecrimCoreData', '~> 4.0'
    pod 'Kingfisher', '~> 2.4'
    pod 'Eureka', '~> 1.6'
    pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
    pod 'PhoneNumberKit', '~> 0.1'
    pod 'PKHUD'
    pod 'Dollar'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '2.2'
        end
    end
end
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Comments from @l'L'l led me to the solution. I went to

build settings > frameworks search path

and set it to the following:

$(inherited) (non-recursive)
$(PROJECT_DIR)/build/Debug-iphoneos (non-recursive)
$(SRCROOT) (recursive)

It is now correctly finding the pod frameworks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...