I am trying to install the Google Mobile Ads SKD into my Xcode project. I installed Cocoapods and then initialized a Podfile into my project:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
target 'Cubical' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Cubical
target 'CubicalTests' do
inherit! :search_paths
# Pods for testing
end
target 'CubicalUITests' do
inherit! :search_paths
# Pods for testing
end
end
However, I don't understand why there are targets within my main project (Cubical). I never really used CubicalTests or CubicalUITests, since I don't really need to test my UI or any snippet of code. I was thinking of removing these two folders.
My questions are,
1) Is there any drawback in removing the Tests and UITests folders from my Xcode project? And if I do, can I just simply delete those two targets from my Podfile?
2) Let's say I was going to keep those two targets. Would I have to add the pod to all three targets? Or do the two nested targets inherit any pods of target 'Cubical'
3) Do I need to add to Linked Frameworks the Google Mobile Ads SDK? Or is this already done by Cocoapods?
My final pod would look like this:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
target 'Cubical' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
# Pods for Cubical
target 'CubicalTests' do
inherit! :search_paths
# Pods for testing
end
target 'CubicalUITests' do
inherit! :search_paths
# Pods for testing
end
end
all targets in Podfile are apps except "Infra" which is a static library. All targets, including Infra, are using Dropbox SDK and therefore must be installed with Dropbox pods. Infra is an embedded subproject (of static library type) in each App project (i.e. Infra project is embedded in BookApp project)
The Podfile specifies the dependencies of each user target. pod is the way to declare a specific dependency. podspec provides an easy API for the creation of podspecs. target is how you scope your dependencies to specific targets in your Xcode projects.
The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. The file should simply be named Podfile.
If you want multiple targets to share the same pods, use an abstract_target. There is implicit abstract target at the root of the Podfile, so you could write the above example as:
Question 1:
There is no issue when you are removing Tests
,CubicalUITests
targets & folders, If you don't need to perform that kind of tests.
Question 2:
You can share pods with several targets like below,
def shared
pod 'Google-Mobile-Ads-SDK'
end
target 'Target1' do
shared
end
target 'Terget2' do
shared
end
Global pods for multiple targets
#Global Pod for all targets
pod 'Google-Mobile-Ads-SDK'
target 'target1' do
pod 'Fabric' #Pod for nested Target. i.e., Google-Mobile-Ads-SDK + Fabric
end
target 'target2' do
pod 'RadioButton'#Pod for nested Target. i.e., Google-Mobile-Ads-SDK + RadioButton
end
Pods for nested targets:
#Global Pod for all targets
pod 'Google-Mobile-Ads-SDK'
target 'target1' do
pod 'RadioButton' #Available for target1 and target2
target 'target2 copy' do
pod 'Fabric' #Available for target2 only
end
end
Question 3:
The linked frameworks are automatically done by cocoapods. See here you need to link the framework by using frameworks without cocoapods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With