Cocoapods + Cannot load underlying module for 'x'

前端 未结 21 754
梦谈多话
梦谈多话 2020-12-25 09:15

I am running XCode 7, Swift 2.0, iOS 9.

I want to install Alamofire in my project using Cocoapods. I have done the following:

gem install cocoapods

相关标签:
21条回答
  • 2020-12-25 09:54

    try Build For testing works for me

    0 讨论(0)
  • 2020-12-25 09:55

    When installing CocoaPods, be sure to specify ios 9.0 by deleteing the #. Therefore, # platform :ios, '9.0' should just be platform :ios, '9.0' Then, if the error shows again, simply build and run. After you build and run, the error should not return.

    Also, this can occur if you have more than one version of Xcode installed on your computer. Quit (not just close) all versions of Xcode first.

    0 讨论(0)
  • 2020-12-25 09:59

    Another possible scenario: make sure the test target is defined within the scope of the parent target (not outside of it)

    e.g.

    target 'MyApp' do
      pod 'GoogleAnalytics', '~> 3.1'
    
      target 'MyAppTests' do
        inherit! :search_paths
        pod 'OCMock', '~> 2.0.1'
      end
    end
    

    If instead it looks like:

    target 'MyApp' do
      pod 'GoogleAnalytics', '~> 3.1'
    end
    
    target 'MyAppTests' do
      inherit! :search_paths
      pod 'OCMock', '~> 2.0.1'
    end
    

    then you'll also receive this error.

    0 讨论(0)
  • 2020-12-25 10:04

    What has helped in my case:

    1) Close the project and XCode

    2) In the terminal repeat command

    > pod install
    

    3) Open the project

    (If it does not help, try to remove Pod/ folder before reinstalling)

    0 讨论(0)
  • 2020-12-25 10:05

    Go to Product > Build and it will resolve the problem:

    0 讨论(0)
  • 2020-12-25 10:05

    I had to do a Product > (Opt Click) Clean Build Folder ... then ran again and the issue was gone.

    0 讨论(0)
提交回复
热议问题