I have a few projects I\'m trying to build with Xcode 6 Beta 2. The projects all have some type of library that uses XCTest (Kiwi/XCTest and Specta) that don\'t build in Xco
@squarefrog has the right answer but you'll have to keep doing that manually each time you update your pods :(
If you add this to your podfile it will automatically add the extra path for you. E.g. if you wanted to add $(PLATFORM_DIR)/Developer/Library/Frameworks
to FRAMEWORK_SEARCH_PATHS
for Specta:
post_install do |installer|
target = installer.project.targets.find { |t| t.to_s == "Pods-Tests-Specta" }
if (target)
target.build_configurations.each do |config|
s = config.build_settings['FRAMEWORK_SEARCH_PATHS']
s = [ '$(inherited)' ] if s == nil;
s.push('$(PLATFORM_DIR)/Developer/Library/Frameworks')
config.build_settings['FRAMEWORK_SEARCH_PATHS'] = s
end
else
puts "WARNING: Pods-Tests-Specta target not found"
end
end
I was moving files in a project around. All you have to do is select your test files xxxTests.m
etc. and in file inspector
select target
as test
and not as a regular target.
As of the time of writing, the latest version of Cocoapods (0.33.1) doesn't have a fix for the problem.
But the cutting edge version does.
Follow this guide to set the latest version of Cocoapods up from source. I call mine pod-dev
(covered in the guide) to distinguish it from the gem-installed version of pods.
The benefit of this approach is that you don't need extra scripting in your Podfile. You just have to remember to do a pod-dev install
instead of the usual pod install
.
I've noticed that XCTest is available to a test target only (in Xcode 6). If you are using using XCTest for any other target (for whatever reason), you will see the XCTest.h not found
error.
On a project without Cocoapods (so not directly answering the OP's question but perhaps helpful for me or others in the future), we had the same issue. It was solved by replacing our previous OCTest items with XCTest. For example, a file MyApp.xcodeproj/project.pbxproj has this diff (shortened) ;
- path = MyAppUnitTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+ path = MyAppUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
This error comes up when you have added a file where XCTest is being used outside of a test target. To fix this in AppCode, you can right click on any suspected file and select 'Manage Targets' then make sure only the test target is checked.