I\'m writing an app in Swift, using XCode 6 Beta-6. I\'m using Cocoapods and I\'m creating some unit tests.
The issue is this one: apparently is not possible to hav
If you take a look at your main target Build Settings, you will see that there are a bunch of directories listed for the "Header Search Paths" settings.
You either need to copy those values under the test target, or you can try and modify your Podfile to include both your main and test targets and re-run install
:
platform :ios, '7.0'
link_with 'mainapp', 'mainappTests'
...
Also take care of any other header paths that could be needed and are not related to CocoaPods.
And don't forget that your classes shall have public methods wherever you want to unit-test them.
Hope this helps.
Maybe you have configured the "Objective-C Bridging Header" setting at Project level, so the "Test" target inherits that value and maybe this "Test" target is not linked with Cocoapods.
Use link_with
as @sergio suggests or set the "Pods*.debug/release" configuration for the "Test" target at "Project->Info->Configuration".
In addition to the link_with
command in my Podfile i had to import my main project module in the test file. This way classes and methods don't have to public.
Note the special @testable annotation
@testable import my_tutorial_app
Also my main project name had non-alphanumerical characters in it, I had to replace them with underscores _