2

We're having some issues integrating CocoaPods in the Calabash target.

At the moment we have 4 targets:

App: normal app target
AppTests: unit tests target
App-Calabash: calabash target
App-API-Stubs: special target

We want to share all the Pods between App, App-Calabash and App-API-Stubs. Also, AppTests and App-Calabash have to include other libraries.

This is our Podfile:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '7.0'

link_with 'App', 'App-Calabash', 'App-API-Stubs'
inhibit_all_warnings!

pod 'MagicalRecord', '~> 2.2'
pod 'AFNetworking', '~> 2.3.1'
pod 'ObjectiveSugar', '~> 1.1.0'
pod 'KZPropertyMapper', '~> 2.5.0'
pod 'FXBlurView', '~> 1.6.2'
pod 'OHHTTPStubs', '~> 3.1.5'
pod 'Google-Maps-iOS-SDK', '~> 1.8.1'
pod 'KVOController', '~> 1.0.1'
pod 'Braintree', '~> 3.3.1'
pod 'TTTAttributedLabel', '~> 1.10.1'
pod 'ObjectiveLuhn', '~> 1.0.0'
pod 'CrashlyticsFramework', '~> 2.2.1'

target 'App-Calabash', :exclusive => true do
  pod 'Calabash', '~> 0.9.169'
end

target 'AppTests', :exclusive => true do
  pod 'Specta', '~> 0.2.1'
  pod 'Expecta', '~> 0.3.0'
  pod 'OCMock', '~> 3.1.1'
end

All the targets build and run just fine but the Calabash one.
It complains it can't find Crashlytics/Crashlytics.h. But even if we temporary avoid to use Crashlytics, it then complains about the Calabash library during the linking:

ld: warning: directory not found for option '-L/Users/Marco/ios/App/Pods/build/Debug-iphoneos'
ld: file not found: -lPods-App-Calabash-Calabash
clang: error: linker command failed with exit code 1 (use -v to see invocation)

So it would seem something is gone terribly wrong integrating pods into that specific target.
I'm pretty sure I'm missing something simple but I can't figure it out.

Any help is really appreciated. Thanks!

Marco Sero
  • 460
  • 6
  • 18
  • 1
    If you find a solution just come back I having some kind of related problem – AsTeR Oct 30 '14 at 16:58
  • My personal problem was related with the fact that I didn't pay attention to the following message, `[!] From now on use 'xperience.xcworkspace'.` which only appearing after the first `pod install`. – AsTeR Oct 30 '14 at 17:06

3 Answers3

1

Took me all morning looking for a solution for this. I have found the answer here http://flexpletives.blogspot.com.es/2014/02/ios7-tdd-w-ocmock-and-xcode5.html

Go to your Calabash target -> Build settings -> Other linker flags

Remove "-force_load" Add "-all_load"

foskon
  • 51
  • 4
1

By specifying exclusive for the App-Calabash target in your Podfile you're saying that you only want to link the Calabash framework and not the others which is why Crashlytics won't be found.

target 'App-Calabash', :exclusive => true do
   pod 'Calabash', '~> 0.9.169'
end

I set Calabash up today using Cocoapods and here's how I got things to work:

1.) Add a new configuration to your project named Calabash or similar (from the Info panel of Project settings).

2.) Update your Podfile with the following line:

pod 'Calabash', :configurations => ['Calabash']

3.) Run pod update from the command line.

4.) Under the Pods project, in Targets Support Files you should find a file called Pods.calabash.xcconfig. Drag (but don't select the 'copy if needed' option) this file to the Pods group in your main project alongside Pods.debug.xcconfig and Pods.release.xcconfig.

5.) In your main project navigate to the Info panel of project settings and expand the Calabash configuration you created in step 1. Your main project's target configuration will be set to Pods.debug or Pods.release. Set it to Pods.calabash.

6.) Create a new scheme called Calabash and edit it. Select the 'Run' phase and in the Info pane select the Calabash build configuration from the drop-down.

7.) In order to run Calabash, select the newly created Calabash scheme and run.

Hope this information helps.

0

The following answer helped me resolve an issue nearly identical to this.

https://stackoverflow.com/a/27039447/1004227

In short, I had to set the Configurations to None for all relevant targets of the Calabash scheme. Then run pod install and let Cocoapods reset the Configuration to a Pods.calabash configuration.

Community
  • 1
  • 1
Pouria Almassi
  • 1,580
  • 2
  • 17
  • 26