CocoaPods + XCTest for unit testing

When using XCTest for unit testing, we often encounter some calls to open source frameworks in CocoaPods, such as "Realm" or "Alamofire"

During testing, if the configuration is incorrect, it will cause an error like "framework not found RealmSwift for architecture x86_64"

In the past, the configuration of many people was to modify the configuration parameters such as the headers of various unit test Targets, but after CocoaPods 1.0, it is very simple, just need to change a little when configuring the Podfile, as follows:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'Proj' do
   under 'Alamofire', '~> 3.4'
    
end
target 'ProjTests' do
    under 'Alamofire', '~> 3.4'
end

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326615181&siteId=291194637