If you are using cocoapods, double check that the default_subspec
(which by omission includes all available subspecs) does not accidentaly bundle XCTest
, e.g. For the following .podspec
Pod::Spec.new do |s|
s.name = 'MySpec'
# ... spec definition details
# "Normal" subspecs
s.subspec 'NormalSubspec1' do |subspec|
# ... subspec details
end
s.subspec 'NormalSubspec2' do |subspec|
# ... subspec details
end
# Testing subspec
s.subspec 'TestingSubspec' do |subspec|
subspec.frameworks = 'XCTest'
# ... subspec details
end
end
if you were to depend on it in a Podfile
as
target 'MyTarget' do
pod 'MySpec'
end
it would include all subspecs (MySpec/NormalSubspec1
, MySpec/NormalSubspec2
, and MySpec/TestingSubspec
).
Whereas, if you also define default_subspec
, then you can exclude MySpec/TestingSubspec
from the default dependency.
Pod::Spec.new do |s|
s.name = 'MySpec'
# ... spec definition details
s.default_subspec = 'NormalSubspec1', 'NormalSubspec2'
# "Normal" subspecs
s.subspec 'NormalSubspec1' do |subspec|
# ... subspec details
end
s.subspec 'NormalSubspec2' do |subspec|
# ... subspec details
end
# Testing subspec
s.subspec 'TestingSubspec' do |subspec|
# ... subspec details
subspec.frameworks = 'XCTest'
end
end
and it would now behave the same way as if you had explicity dependend on the subspecs
target 'MyTarget' do
pod 'MySpec/NormalSubspec1'
pod 'MySpec/NormalSubspec2'
end