Integrating pods with all targets - ios

I have been using CocoaPods for a few weeks now with my iOS app and it works perfectly with the one target I have been testing (let's call it "MainApp"). However, I now want to build a different target ("MyAppLite") and noticed that the build failed (file not found on one of the pods' header files).
The differences in the Build Settings I've noticed are as follows:
Other Linker Flags does not contain the required frameworks in MyAppLite
Framework/Header/Library Search Paths are all empty in MyAppLite
None of the User-Defined Build Settings in MainApp are present in MyAppLite
How can I ensure that when I run pod install, all targets have the libraries linked?
For reference, here is my Podfile:
platform :ios, '5.0'
pod 'TTTAttributedLabel', '~> 1.7.0'
pod 'iRate', '~> 1.7.5'
pod 'MBProgressHUD', '~> 0.6'
pod 'FlurrySDK', '~> 4.2.3'
pod 'ACSimpleKeychain', '~> 0.0.1'
pod 'WEPopover', '~> 0.0.1'
pod 'AFNetworking', '~> 1.3.1'
pod 'Nimbus', '~> 1.0.0'
pod 'QuincyKit', '~> 2.1.9'

For CocoaPods 1.0.0, recommendation from devs is using abstract_target (but not compatible with 0.39.0):
platform :ios, '5.0'
abstract_target 'defaults' do
pod 'TTTAttributedLabel', '~> 1.7.0'
pod 'iRate', '~> 1.7.5'
pod 'MBProgressHUD', '~> 0.6'
pod 'FlurrySDK', '~> 4.2.3'
pod 'ACSimpleKeychain', '~> 0.0.1'
pod 'WEPopover', '~> 0.0.1'
pod 'AFNetworking', '~> 1.3.1'
pod 'Nimbus', '~> 1.0.0'
pod 'QuincyKit', '~> 2.1.9'
target 'MyApp'
target 'MyAppLite'
end
For CocoaPods 0.39.0 + 1.0.0 compatibility, using def works fine (but isn't recommended by devs):
platform :ios, '5.0'
def default_pods
pod 'TTTAttributedLabel', '~> 1.7.0'
pod 'iRate', '~> 1.7.5'
pod 'MBProgressHUD', '~> 0.6'
pod 'FlurrySDK', '~> 4.2.3'
pod 'ACSimpleKeychain', '~> 0.0.1'
pod 'WEPopover', '~> 0.0.1'
pod 'AFNetworking', '~> 1.3.1'
pod 'Nimbus', '~> 1.0.0'
pod 'QuincyKit', '~> 2.1.9'
end
target 'MyApp' do
default_pods
end
target 'MyAppLite' do
default_pods
end

With CocoaPods 1.x
You can use the target blocks
platform :ios, '13.0'
def default_pods
pod 'TTTAttributedLabel', '~> 1.7.0'
pod 'iRate', '~> 1.7.5'
pod 'MBProgressHUD', '~> 0.6'
pod 'FlurrySDK', '~> 4.2.3'
pod 'ACSimpleKeychain', '~> 0.0.1'
pod 'WEPopover', '~> 0.0.1'
pod 'AFNetworking', '~> 1.3.1'
pod 'Nimbus', '~> 1.0.0'
pod 'QuincyKit', '~> 2.1.9'
end
target 'MyApp' do
default_pods
end
target 'MyAppLite' do
default_pods
end
Relevant documentation

If you have large number of targets and don't want to add new target each time, you can use this
def common_pods
pod 'TTTAttributedLabel', '~> 1.7.0'
pod 'iRate', '~> 1.7.5'
pod 'MBProgressHUD', '~> 0.6'
pod 'FlurrySDK', '~> 4.2.3'
pod 'ACSimpleKeychain', '~> 0.0.1'
pod 'WEPopover', '~> 0.0.1'
pod 'AFNetworking', '~> 1.3.1'
pod 'Nimbus', '~> 1.0.0'
pod 'QuincyKit', '~> 2.1.9'
end
project = Xcodeproj::Project.open “./<projectNameHere>.xcodeproj"
project.targets.each do |t|
target t.name do
common_pods
end

From the docs:
If no explicit target is specified, then the Pods target will be linked with the first target in your project.
You can use link_with to link with further targets.
Also see Multiple Targets in the Cocoapods documentation if you need different dependency configurations for different targets

Related

No such module 'Eureka' error while using 'GooglePlacesRow' in Pods

Previously in project, Eureka and GooglePlacesRow were directly embedded.
Now, I am trying to update the Eureka and GooglePlacesRow to latest version using pods.
But this is causing error as "No such module 'Eureka'" only in the files related to GooglePlacesRow.
Xcode version 10.2.1
Swift Version 5
Eureka Version 5.0.0
GooglePlacesRow 3.2.0
I tried the following things:
Clean and build
Deleting Derived data and then build
Checked for Framework Search path as well.
My Podfile:
platform :ios, '11.0'
inhibit_all_warnings!
target 'ProjectName' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for ProjectName
pod 'SnapKit', '~> 4.2.0'
pod 'KeychainAccess', '~> 3.2.0'
pod 'Just', '~> 0.7.1'
pod 'SwiftyJSON', '~> 5.0.0'
pod 'PKHUD', '~> 5.2.1'
pod 'GSMessages', '~> 1.7.2'
pod 'RealmSwift', '~> 3.15.0'
pod 'Pages', '~> 2.0.2'
pod 'IQKeyboardManagerSwift', '~> 6.3.0'
pod 'Firebase/Core', '~> 5.20.2'
pod 'Firebase/Messaging', '~> 5.20.2'
pod 'Firebase/Crash', '~> 5.20.02'
pod 'GradientCircularProgress', :git =>
'https://github.com/keygx/GradientCircularProgress'
pod 'Zip', '~> 1.1.0'
pod 'GRDB.swift', '~> 3.7.0'
pod 'Localize-Swift', '~> 2.0.0'
#pod 'Eureka', '~> 5.0.0'
pod 'GooglePlacesRow', '~> 3.2.0'
end
Thanks in Advance ☺️

How to solve "Expected identifier for type name" caused by CryptoSwift addition

I have a codebase where I am adding CryptoSwift through pods, and after adding it it compiler has started throwing 20 odd errors of type
Expected identifier for type name
My PodFile looks like this
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'TestApp' do
pod 'AWSIoT'
pod 'Fabric'
pod 'Digits'
pod 'Crashlytics'
pod 'PureLayout'
pod 'Amplitude-iOS', '~> 3.11.1'
pod 'SDWebImage', '~>3.8'
pod 'CryptoSwift'
pod 'AWSCognitoIdentityProvider', '~> 2.5.0'
pod 'AWSAPIGateway', '~> 2.5.0'
pod 'AWSS3', '~> 2.5.0'
pod 'PhoneNumberKit', '~> 1.3'
pod 'ReachabilitySwift', '~> 3'
pod 'libPhoneNumber-iOS', '~> 0.8'
pod 'SVProgressHUD'
pod 'Kingfisher', '~> 3.0'
pod 'AwesomeCache', '~> 5.0'
pod 'OHHTTPStubs/Swift'
pod 'SwiftyGif'
end
target 'TestAppRecents' do
pod 'AWSIoT'
pod 'Fabric'
pod 'Digits'
pod 'CryptoSwift'
end
target ‘TestAppTests’ do
pod 'AWSIoT'
pod 'Fabric'
pod 'Digits'
pod 'Crashlytics'
pod 'PureLayout'
pod 'Amplitude-iOS', '~> 3.11.1'
pod 'SDWebImage', '~>3.8'
pod 'AWSCognitoIdentityProvider', '~> 2.5.0'
pod 'AWSAPIGateway', '~> 2.5.0'
pod 'AWSS3', '~> 2.5.0'
pod 'PhoneNumberKit', '~> 1.3'
pod 'ReachabilitySwift', '~> 3'
pod 'libPhoneNumber-iOS', '~> 0.8'
pod 'SVProgressHUD'
pod 'Kingfisher', '~> 3.0'
pod 'AwesomeCache', '~> 5.0'
pod 'OHHTTPStubs/Swift'
pod 'SwiftyGif'
end
Pod gets installed just fine I have added the file to point me out if any conflict
Here is the additional info

.h file not linking when pod install

Mac OS 10.12
xcode 8.1
We are trying to install pod like
platform :ios, '8.0'
target 'ProjectName' do
pod 'ARSafariActivity', '~> 0.0'
pod 'FFBadgedBarButtonItem', '~> 1.0'
pod 'MMDrawerController', '~> 0.5'
pod 'MMProgressHUD', '~> 0.2'
pod 'MMSpreadsheetView', '~> 0.0'
pod 'Mantle', '~> 1.5'
pod 'Masonry', '~> 0.5'
pod 'NHAlignmentFlowLayout', '~> 0.1'
pod 'NMRangeSlider', '~> 1.1'
pod 'PBWebViewController', '~> 0.2'
pod 'SZTextView', '~> 1.1'
pod 'AAPLAdvancedCollectionView', :git => 'https://github.com/zwaldowski/AAPLAdvancedCollectionView.git', :tag => 'v1.0.11'
end
target 'ProjectNameTests' do
pod 'Kiwi', '~> 2.3'
pod 'OHHTTPStubs', '~> 4.0'
end
Giving error lexical and preprocessor issue.
Mantle.h file not found.
We tried with iOS - Build fails with CocoaPods cannot find header files this still not working.
You should specify to use frameworks if you are not planning to add bridging file between swift and Objective - c
Using Pods without Bridge file
update your pod file to
platform :ios, '8.0'
target 'ProjectName' do
use_frameworks!
pod 'ARSafariActivity', '~> 0.0'
pod 'FFBadgedBarButtonItem', '~> 1.0'
pod 'MMDrawerController', '~> 0.5'
pod 'MMProgressHUD', '~> 0.2'
pod 'MMSpreadsheetView', '~> 0.0'
pod 'Mantle', '~> 1.5'
pod 'Masonry', '~> 0.5'
pod 'NHAlignmentFlowLayout', '~> 0.1'
pod 'NMRangeSlider', '~> 1.1'
pod 'PBWebViewController', '~> 0.2'
pod 'SZTextView', '~> 1.1'
pod 'AAPLAdvancedCollectionView', :git => 'https://github.com/zwaldowski/AAPLAdvancedCollectionView.git', :tag => 'v1.0.11'
end
target 'ProjectNameTests' do
pod 'Kiwi', '~> 2.3'
pod 'OHHTTPStubs', '~> 4.0'
end
Now you dont need to import .h files, it gets imported as modules :)
I hope you can see use_frameworks! in updated pod file :)
Using Pods with Bridge file (if you dont want to deal with frameworks but work only with Objective - C files directly)
Create a .h file with name YourAppName-Bridging-header.h
open it and add all the Objective - C files you want to import for example
#ifndef YourAppName_Bridging_Header_h
#define YourAppName_Bridging_Header_h
#endif /* YourAppName_Bridging_Header_h */
#import "Reachability.h"
#import <CommonCrypto/CommonCrypto.h>
Thats it now you can use it in any of the files without worrying to import them again and again.

Cocoapods not generating targets

I'm encountering an issue where whenever I update or add a new library in my podfile and run a pod install, cocoapods is not creating a build target for that library; this makes adjusting a specific pod's build settings impossible.
Specifically, the latest GoogleMap pod, GoogleAnalytics pod, and MapBox pod do this. I'm still pre-1.0 on cocoapods.
If I dive into my Pods/ folder, I see folders for these pods, however no folders in Target Support Files have been created.
Anyone know how to fix this?
My podfile:
platform :ios, '8.0'
pod 'ECSlidingViewController', '~> 2.0.3'
pod 'AFNetworking', '~> 2.5'
pod 'Stripe', '~> 5.0'
pod 'FormatterKit', '~> 1.7'
pod 'GPUImage', '~> 0.1'
pod 'PureLayout', '~> 2.0'
pod 'GoogleMaps', '~> 1.13.2'
pod 'FSCalendar'
pod 'DateTools'
pod 'FZAccordionTableView', '~> 0.1'
pod 'Overcoat', '~> 3.1'
pod 'Mapbox-iOS-SDK', '~> 3.2'
pod 'ISO8601'
pod 'Lookback', :configurations => ['Debug']
pod 'LookbackSafe', :configurations => ['Release']
pod 'QBValidator', '~> 1.0'
pod 'Flurry-iOS-SDK', '~> 7.3'
pod 'UAAppReviewManager'
pod 'TSNPeerBluetooth', '~> 1.0'
pod 'TSNAtomicFlag', '~> 1.0'
pod 'TSNExtensions', '~> 1.0'
pod 'CKStringUtils', '~> 2.0'
pod 'CLLocationManager-blocks', '~> 1.3'
pod 'Socket.IO-Client-Swift', '~> 6.1.0'
pod 'CardIO', '~> 5.3'
pod 'CocoaSecurity'
pod 'SecureNSUserDefaults', '~> 1.0'
pod 'PMTween', '~> 1.3'
pod 'GoogleAnalytics', '~> 3.14'
use_frameworks!
You should modify your podfile like this:
platform :ios, '8.0'
use_frameworks!
target 'YourTarget' do
pod 'ECSlidingViewController', '~> 2.0.3'
pod 'AFNetworking', '~> 2.5'
pod 'Stripe', '~> 5.0'
...
pod 'PMTween', '~> 1.3'
pod 'GoogleAnalytics', '~> 3.14'
end

ld: framework not found Box

I'm getting this error every time when I try to compile the project.
This started happening after adding to pods "use_frameworks!" and updating to use :
#import <MBProgressHUD/MBProgressHUD.h>
Insted of:
#import "MBProgressHUD.h"
for all frameworks.
There is no framework named "box" so I do not understand what this even refer to..
This error shows after all the project compiles, really at the end.
Did any one manage to fix this issue?
Edit
My podfile:
platform :ios, '8.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!
xcodeproj 'Stox'
pod 'FLEX', '~> 2.0', :configurations => ['Debug']
pod 'FBSDKCoreKit', '~> 4.5'
pod 'DCIntrospect-ARC', '~> 0.0.4'
pod 'FiksuSDK', '~> 4.5.0'
pod 'Raven'
pod 'PKRevealController'
pod 'UIImage+BlurredFrame'
pod 'SDWebImage'
pod 'PEPhotoCropEditor'
pod 'Reachability'
pod 'HPGrowingTextView', '~> 1.0.1'
pod 'MBProgressHUD'
pod 'pop', '~> 1.0'
#pod 'UIActionSheet+Blocks'
pod 'AZSocketIO', '0.0.5'
pod 'TSMessages'
#pod 'ReactiveCocoa' , '~> 2.5.0'
pod 'ReactiveCocoa', '3.0'
pod 'NJKWebViewProgress'
pod 'ActionSheetPicker-3.0', '~> 1.2.0'
pod 'Underscore.m'
pod 'Mantle', '~> 1.5'
pod 'RSKImageCropper'
pod "AFNetworking", "~> 1.3.4"
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
pod 'AHKActionSheet', '~> 0.5'
pod 'WYPopoverController', '~> 0.2.2'
pod 'XLPagerTabStrip', '~> 1.0'
pod 'SwipeView', '~> 1.3.2'
pod 'Masonry'
pod 'YLMoment', '~> 0.2.0'
pod 'YIInnerShadowView', '~> 1.1'
pod 'LinqToObjectiveC', '~> 2.0'
pod 'Typhoon'
pod 'CDRTranslucentSideBar'
pod "ZFDragableModalTransition"
pod 'LVDebounce'
pod 'AsyncDisplayKit', '~> 1.2'
pod 'PhotoTweaks', '~> 1.0.1'
pod 'Shimmer', '~> 1.0'
pod 'IHKeyboardAvoiding'
pod 'Parse', '~> 1.8.4'
pod 'DBPrivacyHelper'
pod 'AppsFlyer-SDK'
pod 'KLCPopup', '~> 1.0'
pod 'Vertigo'
pod 'iRate', '~> 1.11'
target 'StoxUITests' do
use_frameworks!
pod 'Nocilla'
pod 'OHHTTPStubs', '~> 4.3'
end
Workaround to resolve this issue (Temporary fix :) )
Create a folder called "Box.framework" anywhere on your computer. Note the full path to this folder.
Create an empty file called "Box" inside of "Box.framework"
Click on your project and go to the "Build Settings" tab.
Find "Framework Search Paths" in your Build Settings (you can search for
"Framework Search Paths" in the search bar at the top)
Double click on the Framework Search Path and press the "+" button.
Add the path which points to the "Box.framework" folder that you created in step1.
Let me know if that resolves your issue.

Resources