Why does Cocoapods adds HockeyMac-SDK to my iOS Target? - ios

Given that Podfile
workspace 'Foo'
target :Foo_Mac do
xcodeproj 'Mac/Foo_Mac'
platform :osx
pod 'HockeySDK-Mac'
end
target :Foo_iOS do
xcodeproj 'Foo_iOS'
platform :ios, '7.0'
pod 'Parse-iOS-SDK'
end
How comes both my Pods-Foo_iOS.xcconfig & Pods-Foo_Mac.xcconfig contains
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/HockeySDK-Mac" "${PODS_ROOT}/Headers/Parse-iOS-SDK"
Shouldn't it just have the ones from the Podfile?

You’re absolutely right, that’s a bug. Please file a ticket.

Related

Cocoapod can't identify my target after it was renamed

I had been using cocoapods to pod stuff but after I've renamed my whole xcode project, the cocoapod doesn't reconise my renamed target when I am trying to pod lottie, and I don't know how to replace the target with the new one
This error showed in terminal
[!] Unable to find a target named `Infinity Math`, did find `Infinity Math.temp_caseinsensitive_rename`, `Infinity Math.temp_caseinsensitive_renameTests`, and `Infinity Math.temp_caseinsensitive_renameUITests`.
My Pod file
platform :ios, '12.0'
target 'Infinity Math' do
use_frameworks!
pod 'UITextField+Shake', '~> 1.2'
pod 'SPAlert'
pod 'CBFlashyTabBarController'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'
pod 'lottie-ios'
target 'InfinityMathTests' do
inherit! :search_paths
end
target 'InfinityMathUITests' do
inherit! :search_paths
end
end
What should I do next in order to pod new pods?
Give the targets in the Podfile the same names that show up in Xcode:
target 'Infinity Math' do
target 'Infinity MathTests' do
target 'Infinity MathUITests' do
I've fixed it by renaming the target to the ones in the error
InfinityMath.temp_caseinsensitive_rename,
InfinityMath.temp_caseinsensitive_renameTests, InfinityMath.temp_caseinsensitive_renameUITests
It's weird

Exclude pod depends on platform in podfile

I need to exclude a pod from my podfile depends on the platform. I don't want to add another target, my podfile needs have only 1 target.
Here an example:
target 'single_target' do
#if platform is iOS
pod 'PodForIOS'
#if platform is OSX
pod 'PodForOSX'
end
My issue: How can I specify which pods belongs to which platform ?
Thanks
Finnaly I've found a solution
In the podfile:
target 'single_target' do
pod 'PodForIOS'
pod 'PodForOSX'
end
In the .podspec:
# Speficy platforms
s.platform = :ios, :osx
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
# Set dependency
s.ios.dependency 'PodForIOS'
s.osx.dependency 'PodForOSX'
A target in a Podfile refers to a target in an .xcproject. And those are strictly tied to a specific plateform:
So you should go with one abstract target (in Podfile) and multiple targets (in Project).

How can I replace link_with with target blocks?

I have updated cocoapods today to 1.0.0 version. I got this string when I update the pods:
[!] InvalidPodfilefile: [!] The specification oflink_within the Podfile is now unsupported, please use target blocks instead..
The content of my Pod file is
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'QuickStart' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for QuickStart
source 'https://github.com/CocoaPods/Specs.git'
link_with ['QuickStart']
xcodeproj 'QuickStart'
pod 'ADALiOS', :git => 'https://github.com/AzureAD/azure-activedirectory-library-for-objc.git', :branch=> 'convergence'
pod 'NXOAuth2Client'
source 'https://github.com/CocoaPods/Specs.git'
link_with ['QuickStart']
xcodeproj 'QuickStart'
pod 'ADALiOS'
end

Error ITMS-90206 Invalid bundle contains disallowed file 'Frameworks'

I have a problem uploading my application into the Store via Xcode, this one in particular.
I saw a lot of post about this error, but all are talking about Extension App, that I do not use.
I'm using a Custom framework and Cocoapods.
You can see here my tree :
XXX is my project app name
SharedXXX is my custom framework
Pods is the project created by cocoa pods
Here is my cocoa podFile :
use_frameworks!
link_with 'XXX', 'SharedXXX'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
workspace 'XXX'
xcodeproj 'XXX/XXX.xcodeproj'
xcodeproj 'Shared/SharedXXX.xcodeproj'
def default_pods
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod "SnapKit", '~> 0.17.0'
pod "DKChainableAnimationKit", '~> 1.6.0'
pod "AsyncSwift"
end
def shared_pods
pod "Alamofire", '~> 3.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift', :git => 'https://github.com/ashleymills/Reachability.swift'
end
target :XXX do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :XXXDev do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :SharedXXX do
xcodeproj 'Shared/SharedXXXX.xcodeproj'
shared_pods
end
Build settings for custom framework (SharedXXX) :
I set the Embedded property to Yes
General Settings for custom framework (SharedXXX) :
The framework provided by Cocoapods is linked.
And to finish,
The General Settings to the main project (App Project : called XXX on the tree)
:
Any idea ?
I solved the problem
Firstly, set into Build Settings
For main project (here XXX) : Embedded Content Contains Swift Code to
YES
Custom Framework (SharedXXX) : Embedded Content Contains Swift Code to NO
Custom Framework (SharedXXX) : Runpath Search Path = #executable_path/../../Frameworks
This helped me solving that issue
I faced the same problem while trying to upload from Xcode 9.3
This happened because I added 'use_frameworks' in my OneSignal
NotificationServiceExtension
The value Always Embed Swift Standard Libraries found in Build Settings should be set to Yes only for you main Projects and not for your custom frameworks or extensions.

Meaning of each Cocoapods build target

What is the purpose of each target in a Cocoapods workspace?
When I created a new CocoaPods library via "pod lib create Foo", I expected only two targets: One to build my library, and one to build my example.
But the resulting xcworkspace has a total of four targets:
Project Foo
Target Foo_Tests
Project Pods
Target Pods-Foo_Tests
Target Pods-Foo_Tests-Foo
Target Pods-Foo_Tests-Foo-Foo
What's the meaning of these targets?
(I chose no demo application, view-based testing, or testing frameworks.)
There are 2 project in your workspace one is yours and the other is cocoapods, and cocoapods adds new target for each pod which you add in your Podfile. For example, let's say this is your Podfile :
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.5.4'
pod 'BPXLUUIDHandler'
you should see in your pod project's target list something like this :
but what is that mean?
Targets where cocoapods manage everything for each pod. For example if you choose AFNwtworking target in pod project, you must see something like this :
but for example how cocoapods know to add "Link binary with libraries" frameworks like above? Well, please check AFNetworking's podspec file for this :
s.public_header_files = 'AFNetworking/*.h'
s.source_files = 'AFNetworking/AFNetworking.h'
s.subspec 'Serialization' do |ss|
ss.source_files = 'AFNetworking/AFURL{Request,Response}Serialization.{h,m}'
ss.ios.frameworks = 'MobileCoreServices', 'CoreGraphics'
ss.osx.frameworks = 'CoreServices'
end
s.subspec 'Security' do |ss|
ss.source_files = 'AFNetworking/AFSecurityPolicy.{h,m}'
ss.frameworks = 'Security'
end
s.subspec 'Reachability' do |ss|
ss.source_files = 'AFNetworking/AFNetworkReachabilityManager.{h,m}'
ss.frameworks = 'SystemConfiguration'
end
as you can see above this lines "ss.ios.frameworks" are describe what is going on there.
Hope everything is clear now.

Resources