Cocoapods: duplicate interface definition

cocoapods, ios, swift, xcode, xcode6

Solution

Have you tried updating to the latest release of CocoaPods? I noticed you mentioned you're using an outdated release candidate, which is possibly at fault here.

In general, here's what you need to do when creating and using a CocoaPod in your app:

1) In your CocoaPod, declare all of your dependencies in the pod spec, using `s.dependency` for each

2) In your app, use CocoaPods to manage all of of your app dependencies. That is, don't manually drag-and-drop libraries into your app. If you do, you risk creating duplicate classes with the ones that you drag-and-drop include.

3) In both your app and CocoaPod, depend on as flexible versions as you can. In general, you should at least allow for minor version updates, e.g. `pod 'PodName', '~> 1.0.0'`.

4) In your app's pod file, specify a target for your app and your unit test target, e.g.

target "MyApp" do
  # App pods...
end

target "MyAppTests", :exclusive => true do
  # Test pods...
end

If you have more than two targets, specify a target for each. Or, at the very least, specify a different target for unit tests, which will get the app injected into it.

Problem

I' wrapped my private library into CocoaPods. It has dependency on ReactiveCocoa. ``` s.name = 'MineLibrary' s.dependency 'ReactiveCocoa/Core' s.source_files = 'Source/*.{h,m,swift}' .... ``` Some header files contain: ``` #import <ReactiveCocoa/RACSignal.h> ``` I include it in a new project: ``` use_frameworks! .... pod 'ReactiveCocoa' pod 'MineLibrary', :git => 'git@.....' ``` But when I compile the project, I'm getting this error: ``` duplicate interface definition for class 'RACStream' duplicate interface definition for class 'RACSignal' /Users/USER/Library/Developer/Xcode/DerivedData/Project-emcwpmbbuimotuftzijeemvngrvj/Build/Products/Debug-iphoneos/Pods/ReactiveCocoa.framework/Headers/RACStream.h:27:1: error: duplicate interface definition for class 'RACStream' @interface RACStream : NSObject ^ /Users/USER/Workspace/Project/Pods/ReactiveCocoa/ReactiveCocoa/RACStream.h:27:12: note: previous definition is here @interface RACStream : NSObject ``` How can it be solved? P.S. I'm using CocoaPods 0.36.0.rc.1

Original source