Question

I am new to both Kiwi and Cocoapods. I have Cocoapods up and running however even before I start playing with Kiwi my testing target fails with errors like this:

Undefined symbols for architecture i386:
  "_CGRectZero", referenced from:
  -[EGOImageButton initWithPlaceholderImage:delegate:] in libPods.a(EGOImageButton.o)

This is my Podfile:

platform :ios
dependency 'RestKit/Network', '~>0.10.0'
dependency 'RestKit/UI', '~>0.10.0'
dependency 'RestKit/ObjectMapping', '~>0.10.0'
dependency 'RestKit/ObjectMapping/XML', '~>0.10.0'
dependency 'RestKit/ObjectMapping/JSON', '~>0.10.0'
dependency 'RestKit/ObjectMapping/CoreData', '~>0.10.0'
dependency 'SVProgressHUD'
dependency 'EGOImageLoading'
dependency 'OHAttributedLabel'
dependency 'SFHFKeychainUtils'

target :test, :exclusive => true do
    dependency 'Kiwi'
end
Was it helpful?

Solution

You'll have to do some basic setup, similar to the instructions on the Kiwi Wiki for installing Kiwi from scratch (https://github.com/allending/Kiwi/wiki/Guide:-Up-and-Running-with-Kiwi)

  1. In Xcode, add a Unit Test target named "test" to the application project (Add Target / Cocoa Touch Unit Test Bundle)
  2. Add the Kiwi reference to the PodFile (as you have above)
  3. run pod install.
  4. Edit the schema for your primary target, add the unit test target to the Tests tab (so you can do cmd-U)
  5. Add the path to the Main Target's executable to the BundleLoader build setting in the Unit Test Target : eg. $(BUILT_PRODUCTS_DIR)/Foo.app/Foo
  6. Add your Kiwi tests to the test target

OTHER TIPS

Do your tests rely on your other Cocoapods dependencies? In your Podfile, try removing the :exclusive => true in your test target. This will allow your other dependencies to be included in your test target, but will limit Kiwi to only be in your test target.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top