Add cocoapods to tests target too? [duplicate]
Asked Answered
E

2

23

I have default project template with tests and cocoapods installed (pod install). Pods works fine with main target, but when I try to import something in tests, I get something like

Time.m:11:9: 'NSDate-Utilities.h' file not found

Does this mean that I should add pods directory to header search path in tests target? Can this be done via cocoapods CLI automatically somehow?


That question by suggested link had WRONG answer until yesterday.

Exstipulate answered 25/7, 2013 at 6:5 Comment(0)
E
57

Ok, there is a simple solution, see answer above to get this working automatically. I had to select Pods/Pods configuration file for tests target in project info.

configuration file settings

Exstipulate answered 25/7, 2013 at 6:18 Comment(3)
Thank you, this worked. It took me some time to find this. Here is it in Xcode 6.1: Your Project → Project (blue icon) from the topleft dropdown menu → Info tab → Configurations.Henson
This is a bad idea since it could get overwritten on future pod installsTriadelphous
I found that link_with was not enough - and had to have link_with AND manually set the config as described in this answerSaccharoid
T
38

What you want to use is link_with from your Podfile. Something like:

link_with 'MainTarget', 'MainTargetTests'

Then run pod install again.

Triadelphous answered 25/7, 2013 at 14:39 Comment(1)
This command is now outdated.Fortis

© 2022 - 2024 — McMap. All rights reserved.