Workspace does not build after pod install

2019-09-16 08:29发布

问题:

I have two swift projects, application and library, where library is a dependency of application. I have a Podfile configured as so;

workspace 'myworkspace'
platform :ios, '9.0'

use_frameworks!

target :library do
    project 'library/library.xcproject'
    pod 'GCDWebServer', '~> 3.0'
    target :application do
        project 'application/application.xcproject'
    end
end

After running pod install successfully, I open myworkspace in Xcode, and find application as the currently selected scheme. Immediately building results in failure, due to;

No such module 'library'

To solve this I need to change the current scheme to library, build, then switch the scheme back to application and it will successfully build.

Questions;

  1. Is this expected, or a bug in xcode and/or CocoaPods, or have I configured something incorrectly?
  2. Does this mean I need to separately build library anytime library source changes occur to reflect those changes in application builds?

Xcode 7.3, CocoaPods 1.0.1, repo

回答1:

Try do the followings:

1.Open the 'xxx.xcworkspace' file to run your project. Do not open 'xxx.xcodeproj' to run your project again.

2.Product->Clean->Run

3.Add all the pod targets to 'Linked Frameworks and Libraries' in Project -> General