I am trying to write some iOS logic tests against classes in my project that use functionality from some of the libraries in my podspec. I am using the standard unit test bu
I had issues using OpenCV under XCTest. It was giving me linker errors of Undefined symbols for architecture arm64 for classes like cv::Mat. I am installing OpenCV through CocoaPods using pod 'OpenCV', '~> 2.0' under the main target. No matter how hard I tried to put the OpenCV dependency under the test target or use inherit! :search_paths none of it worked. The solution was to create an abstract_target like so:
# Uncomment the next line to define a global platform for your project
platform :ios, '6.1.6'
abstract_target 'Shows' do
pod 'RMVision', path: '../..'
pod 'RMShared', path: '../../../RMShared'
pod 'OpenCV', '~> 2.0'
target 'RMVisionSample' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for RMVisionSample
end
target 'RMVisionSampleTests' do
# inherit! :search_paths
# Pods for testing
end
target 'RMVisionBenchmarks' do
# inherit! :search_paths
# Pods for testing
end
end
Also useful are the pod deintegrate & pod clean commands which help to cleanup the project and make sure that you start fresh when testing. You can install those two using [sudo] gem install cocoapods-deintegrate cocoapods-clean.