Cocoapods podfile target adding frameworks to tests only - ios

I'm trying to modify my podfile to include pods for networking testing in the test target. This is what my podfile looks like:
target 'BPD-mobile' do
# Used to simplify reads/writes to coredata
pod 'MagicalRecord', '~> 2.3.0' #obj-c
pod 'MFSideMenu', '~> 0.5.5' #obj-c
pod 'UIDevice-Hardware', '~> 0.1.7' #obj-c
pod 'Flurry-iOS-SDK', '~> 7.1.1' #obj-c
pod 'AKNumericFormatter', '~> 0.0.2' #obj-c
pod 'JSBadgeView', '~> 1.3.2' #obj-c
pod 'RETableViewManager', '~> 1.6' #obj-c
pod 'RNBlurModalView', '~> 0.1.0' #obj-c
pod 'APLKeyboardControls', '~> 0.1.3' #obj-c
pod 'MBProgressHUD', '~> 0.9.1' #obj-c
pod 'RBStoryboardLink', '~> 0.1.4' #obj-c
pod 'DTCoreText', '~> 1.6.16' #obj-c
# This pod is used for all networking requests
pod 'AFNetworking', '~> 3.1.0' #obj-c
pod 'MTMigration', '~> 0.0.5' #obj-c
pod 'Harpy', '~> 3.3.10' #obj-c
pod 'SDWebImage', '~> 3.7.3' #obj-c
pod 'ELCImagePickerController', '~> 0.2.0' #obj-c
pod 'UAAppReviewManager', '~> 0.2.6' #obj-c
pod 'DZNEmptyDataSet', '~> 1.7.2' #obj-c
# Used to report crashes to github and open issues for them
pod 'Fabric'#, '~> 1.6.4' #obj-c
pod 'Crashlytics'#, '~> 3.8.2' #obj-c
pod 'DeepLinkKit', '~> 1.1.0' #obj-c
# User for UI Layout and additional widgets
pod 'Eureka', '~> 2.0.0-beta.1' #swift 3.0
# Adds pull screen down for callback functionality, used to
# sync with server
pod 'PullToRefreshCoreText', :git => 'https://github.com/BigPurpleDot/PullToRefreshCoreText' #obj-c
# Pods to only be used for this target
target "BPD-mobile Tests" do
# This pod is used to hijack http methods and respond with
# pre recorded information
pod 'OHHTTPStubs', '~> 5.2.3'
# This pod is used to record http response data for reuse
pod 'SWHttpTrafficRecorder', '~> 1.0.2'
end
end
Notice I have the test target nested in the BPD-mobile target. When I try to compile this it says that the "Pods_BPD_mobile_Tests" framework isn't found. I looked at the pods folder in my project and this is what they look like:
'Pods-BPD-mobile',
'Pods-BPD-mobile-BPD-mobile Tests'
the 'Pods_BPD_mobile Tests' pod is in red. I'm assuming I need either the podfile to be structured in a way for the tests framework to output to 'Pods_BPD_mobile Tests' or I have to change some setting so it looks for the tests framework under the new path. What setting do I have to change/ how should my podfile look for my project to build?
EDIT:
The problem seems to be that there's a space in the name of the target:
https://github.com/CocoaPods/CocoaPods/issues/3754
I don't quite understand the solution though, can someone elaborate?

Alright so this had nothing to do with my configurations and was a cocoapods error. Because my target has a space in the name I had to manually edit the scrips run for both the test target and the main target and add single quotes around "$1" turning it into: '"$1"' as per this github issue:
https://github.com/CocoaPods/CocoaPods/issues/3754

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 ☺️

.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.

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.

Getting errors on installing new pod file

There are pod files installed in my project.
Now I want to add new pod file for 'PhotoPickerPlus' , but I am getting duplicate symbols errors and warnings as seen in following screenshot ;
I have tried to install pod file by using
pod install
It is successfully installed. I have also inclueded all required frameworks.
My pod file is as follows ;
platform :ios, '6.0'
# ignore all warnings from all pods
inhibit_all_warnings!
pod 'ARGenericTableViewController', '~> 1.0.0'
#pod 'CocoaLumberjack', '~> 1.6'
pod 'TBXML', '~> 1.5'
pod 'GoogleAnalytics-iOS-SDK', '~> 2.0beta4'
#pod 'FlurrySDK', '~> 4.1.0'
pod 'SDWebImage', '~> 3.5.4'
#pod 'PSTCollectionView', '~> 1.2.0'
pod 'BSKeyboardControls', '~> 2.2'
pod 'HockeySDK', '~> 3.5.4'
pod 'MBProgressHUD', '~> 0.8'
pod 'MKMapView+AttributionView', '~> 0.1.0'
pod 'Facebook-iOS-SDK', '~> 3.13.0'
pod 'TTTAttributedLabel', '~> 1.9.0'
pod 'JASidePanels'
#pod 'ARChromeActivity', '~> 1.0.1'
#pod 'TUSafariActivity', '~> 1.0.0'
pod 'REComposeViewController', '~> 2.3.1'
pod 'iRate', '~> 1.9.3'
pod 'PhotoPickerPlus', '~> 2.2'
pod 'UIPhotoGallery', :podspec => 'UIPhotoGallery.podspec'
But I am getting errors after installing this file.
What can be the issue?
Maybe your Other Linker Flags inside the Build Settings inside your project is set wrong. Click on your Project inside Project Navigator. If you select your app on PROJECT your Build Settings should look like this
Inside my project I also deleted everything inside Other Linker Flags but maybe it works for you if you insert this
And of course never forget cleaning after these steps.
In you Project Settings, Check target's "Build Phases"'s "Compile source" section. Make sure there are no duplicate copies.
BTW, These errors are generated by https://github.com/gameclosure/trademob which is not even in your pod file.
So again, verify your project settings. Probably you are trying to add pod file to existing project.

Integrating pods with all targets

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

Resources