Can't link Pods to Calabash target - ios

We're having some issues integrating CocoaPods in the Calabash target.
At the moment we have 4 targets:
App: normal app target
AppTests: unit tests target
App-Calabash: calabash target
App-API-Stubs: special target
We want to share all the Pods between App, App-Calabash and App-API-Stubs.
Also, AppTests and App-Calabash have to include other libraries.
This is our Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
link_with 'App', 'App-Calabash', 'App-API-Stubs'
inhibit_all_warnings!
pod 'MagicalRecord', '~> 2.2'
pod 'AFNetworking', '~> 2.3.1'
pod 'ObjectiveSugar', '~> 1.1.0'
pod 'KZPropertyMapper', '~> 2.5.0'
pod 'FXBlurView', '~> 1.6.2'
pod 'OHHTTPStubs', '~> 3.1.5'
pod 'Google-Maps-iOS-SDK', '~> 1.8.1'
pod 'KVOController', '~> 1.0.1'
pod 'Braintree', '~> 3.3.1'
pod 'TTTAttributedLabel', '~> 1.10.1'
pod 'ObjectiveLuhn', '~> 1.0.0'
pod 'CrashlyticsFramework', '~> 2.2.1'
target 'App-Calabash', :exclusive => true do
pod 'Calabash', '~> 0.9.169'
end
target 'AppTests', :exclusive => true do
pod 'Specta', '~> 0.2.1'
pod 'Expecta', '~> 0.3.0'
pod 'OCMock', '~> 3.1.1'
end
All the targets build and run just fine but the Calabash one.
It complains it can't find Crashlytics/Crashlytics.h. But even if we temporary avoid to use Crashlytics, it then complains about the Calabash library during the linking:
ld: warning: directory not found for option '-L/Users/Marco/ios/App/Pods/build/Debug-iphoneos'
ld: file not found: -lPods-App-Calabash-Calabash
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So it would seem something is gone terribly wrong integrating pods into that specific target.
I'm pretty sure I'm missing something simple but I can't figure it out.
Any help is really appreciated. Thanks!

Took me all morning looking for a solution for this. I have found the answer here http://flexpletives.blogspot.com.es/2014/02/ios7-tdd-w-ocmock-and-xcode5.html
Go to your Calabash target -> Build settings -> Other linker flags
Remove "-force_load"
Add "-all_load"

By specifying exclusive for the App-Calabash target in your Podfile you're saying that you only want to link the Calabash framework and not the others which is why Crashlytics won't be found.
target 'App-Calabash', :exclusive => true do
pod 'Calabash', '~> 0.9.169'
end
I set Calabash up today using Cocoapods and here's how I got things to work:
1.) Add a new configuration to your project named Calabash or similar (from the Info panel of Project settings).
2.) Update your Podfile with the following line:
pod 'Calabash', :configurations => ['Calabash']
3.) Run pod update from the command line.
4.) Under the Pods project, in Targets Support Files you should find a file called Pods.calabash.xcconfig. Drag (but don't select the 'copy if needed' option) this file to the Pods group in your main project alongside Pods.debug.xcconfig and Pods.release.xcconfig.
5.) In your main project navigate to the Info panel of project settings and expand the Calabash configuration you created in step 1. Your main project's target configuration will be set to Pods.debug or Pods.release. Set it to Pods.calabash.
6.) Create a new scheme called Calabash and edit it. Select the 'Run' phase and in the Info pane select the Calabash build configuration from the drop-down.
7.) In order to run Calabash, select the newly created Calabash scheme and run.
Hope this information helps.

The following answer helped me resolve an issue nearly identical to this.
https://stackoverflow.com/a/27039447/1004227
In short, I had to set the Configurations to None for all relevant targets of the Calabash scheme. Then run pod install and let Cocoapods reset the Configuration to a Pods.calabash configuration.

Related

Cocoapods not setting search paths correctly

I opened an iOS (Swift) project today I hadn't touched for a while and it wouldn't build. The first import statement for a Cocoapods framework was throwing a No such module compile error in Xcode. Changing the order of import statements made the error throw on whichever was the first external dependency in my import list.
I fixed this by adding each of my Cocoapods to Framework Search Paths in my project's main target (it has a few targets, including tests, a share extension, and a framework of shared code for the app and extension). These search paths were empty and now look like this:
After doing that the project built fine, but now I'm getting this SIGABRT error every time I try to run the app (both on simulator and device):
dyld: Library not loaded: #rpath/CocoaLumberjack.framework/CocoaLumberjack
Referenced from: [path removed]
Reason: image not found
My guess is this is to do with CocoaLumberjack needing to be linked somewhere else/some other way because of its macros but I don't really know.
I've also tried running pod install, cleaning the build folder and deleting derived data, and running pod deintegrate + pod install with no success.
Is it possible to get Cocoapods to automatically set up my search paths correctly so I don't have these issues? Or is there a manual step I'm missing or have done wrong perhaps?
Edited to add my Podfile:
platform :ios, '11.0'
use_frameworks!
# ignore all warnings from all pods
inhibit_all_warnings!
# This is my shared framework, used by both my app and share extension
target 'XXXShared' do
pod 'SnapKit', '~> 4.0'
pod 'KeychainSwift', '~> 7.0'
pod 'Reveal-SDK', :configurations => ['Debug']
pod 'IQKeyboardManagerSwift'
pod 'APESuperHUD', :git => 'https://github.com/apegroup/APESuperHUD.git'
pod 'WSTagsField', '~> 3.1'
pod 'Cache', '~> 4.2'
pod 'TableKit', '~> 2.5'
pod 'GRDB.swift', '~> 3.2'
pod 'PromiseKit', '~> 6.0'
pod 'Toast-Swift', '~> 3.0.1'
pod 'CocoaLumberjack/Swift'
pod 'CollectionKit'
pod 'PinLayout'
pod 'FlexLayout'
pod 'LayoutKit'
pod 'PromiseKit/Alamofire'
pod 'Alamofire', '~> 4.7'
end
target 'XXX' do
pod 'Reveal-SDK', :configurations => ['Debug']
end
target 'XXX share extension' do
inherit! :search_paths
end
Edited to add screenshots:

Error on "pod install --verbose"

I just installed pod with this command
sudo gem install cocoapods
git cloned a project from git repository and run pod install --verbose and I get this error:
Resolving dependencies of `Podfile`
[!] Unable to integrate the following embedded targets with their respective host targets (a host target is a "parent" target which embeds a "child" target like a framework or extension):
- MyApp (true) and OneSignalNotificationServiceExtension (false) do not both set use_frameworks!.
I can't get this app tower inside Xcode because of this. I get this error message:
update
this is my (the only one) Podfile
update 2
after putting up the use_frameworks! line I get this:
add use_frameworks! to solve this problem on OneSignalNotificationServiceExtension.
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal', '>= 2.5.2', '< 3.0'
end
Okay!
Looks like the solution in your case was to move use_frameworks! up and out of a specific target and make it global for the Podfile.
The issues you're now seeing (in your Update 2) is that you need to go into your Project Settings and fix the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES setting. I'd recommend simply removing the build setting.
Just declare the use_frameworks! line globally.
It worked for me!!!
Sample Code below :
use_frameworks!
target 'my_project' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end

Cocoapods : target has transitive dependencies that include static binaries when installing 'VialerSIPLib'

I'm trying to install an objective-c Wrapper for Jsip 'VialerSIPLib' and use it in my swift project here is my pod
platform :ios, ’10.0’
use_frameworks!
target 'EMedicalAdmin' do
pod 'ObjectMapper', '~> 2.1'
pod 'Alamofire', '~> 4.3'
pod 'SwiftyAvatar', '~> 1.0'
pod 'AlamofireImage', '~> 3.1'
pod 'Eureka', '~> 2.0.0-beta.1'
pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'develop'
pod 'PKHUD', '~> 4.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'ImageSlideshow', '~> 1.1.0'
pod 'SwiftyJSON'
pod "FlexibleSteppedProgressBar"
pod 'BTNavigationDropdownMenu', :git => 'https://github.com/PhamBaTho/BTNavigationDropdownMenu.git', :branch => 'swift-3.0'
pod 'VialerSIPLib'
end
but i get this error when installing :-
target has transitive dependencies that include static binaries:
and if i remove
use_frameworks!
from my podfile it would work but all my other swift based pods won't work
so, i'm left with using only this one pod (VialerSIPLib) or Use all my other pods except it
Please add this to your podspec: s.static_framework = true
This is available from cocoapods version 1.4.0.
It worked for me.!!
use_frameworks! should be enough but sometimes the pod.lock file gets corrupted.
So you can delete the pod.lock file and then do
pod repo update and pod install
if any one is Still wondring ,it can't be Done
Using dynamic vendored frameworks shouldn't be a problem even if the
developer isn't using CocoaPods with use_frameworks!, unless they for
some reason need a static lib, such as if building a command line
tool, where static linking is preferable.
So .You Could add the static library manually and link it in you project or wait for the vendor to Change the library into a dynamic Framework
More info here
For me this is how i solved it :-
1- Downloaded the static library using Cocoapods without use_frameworks!
2- used Carthage for Adding other libraries
3- and if a library Doesn't have a Carthage support i would do it manually (Not advised since alot of Duplicate dependencies may Appear)
I put up a repo to show how to do: https://github.com/Lucashuang0802/CocoaPodsWithCarthage
There are a couple things to do:
- install your objective-c lib via CocoaPods without indicating use_framework! in the Podfile
- install your pure Swift module via Carthage
You should be able to compile fine with this solution.
It's a weird one.
For me uninstalling and installing again worked.
Steps -
Comment(#) the error causing pod in pod file
Pod install
Uncomment the line in pod file and save
Pod install

How to solve Xcode build error "No such module RxCocoa"?

I'm very new on Mac / iOS development with Xcode and I have trouble on building my App. I work since 4 days on that issue, but I have no more ideas to find the reason.
The App has 6 projects, bundled in a xcworkspace. I added via cocoapods and via terminal with command pod install RxSwift, RxCocoa, OMGHTTPURLRQ, PromiseKit and SVWebViewController successfully. The projects without dependencies could build successfully. Two projects (libraries) with command "import RxCocoa" and "import RxSwift" in *.swift files are failed with error "No such module 'RxCocoa'".
I read some Stackoverflow posts and the RxSwift Git documentation to solve the issue, without success.
Screenshot of build error and added reference
Podfile definition:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
use_frameworks!
target 'CheckMyBus' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
pod 'PromiseKit', '~> 3.2.1'
pod 'SVWebViewController', '~> 0.2‘
end
Pods installation via terminal:
MacMinis-Mac-mini:CheckMyBus MacMini$ pod install
Analyzing dependencies
Downloading dependencies
Using OMGHTTPURLRQ (3.1.3)
Using PromiseKit (3.2.1)
Using RxCocoa (2.3.1)
Using RxSwift (2.3.1)
Using SVWebViewController (0.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 5 total pods installed.
[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
[!] The `CheckMyBus [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-CheckMyBus/Pods-CheckMyBus.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `CheckMyBus [Release]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-CheckMyBus/Pods-CheckMyBus.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
MacMinis-Mac-mini:CheckMyBus MacMini$
Can anybody help me?
I solved the issue. The solution was so simple, but I had previously found no documentation to use pods with several libraries.
I forgot to add pods definitions in the Podfile for the libraries.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
workspace 'MyWorkspace'
use_frameworks!
target 'MainProj' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
pod 'PromiseKit', '~> 3.2.1'
pod 'SVWebViewController', '~> 0.2‘
project 'MainProj'
end
target 'Lib1' do
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
project 'Lib1/Lib1.xcodeproj'
end
target 'Lib2' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
project 'Lib2/Lib2.xcodeproj'
end
Note: Build works, but not Test! Explanation: CocoaPods Podfile config issue. The given pod/framework is specified for the non test main target, maybe even for the (unit) Test target, but not for the UI Test target! E.g.: platform :ios, '9.0' use_frameworks! target 'Xyz' do pod 'MessageK…

Pod install displaying error in cocoapods version 1.0.0.beta.1

My podfile was working but after updating to cocoapods version 1.0.0.beta.1
pod install displays following error
MacBook-Pro:iOS-TuneIn home$ pod install
Fully deintegrating due to major version update
Deleted 1 'Copy Pods Resources' build phases.
Deleted 1 'Check Pods Manifest.lock' build phases.
Deleted 1 'Embed Pods Frameworks' build phases.
- libPods.a
- Pods.debug.xcconfig
- Pods.release.xcconfig
Deleted 1 'Copy Pods Resources' build phases.
Deleted 1 'Check Pods Manifest.lock' build phases.
- libPods.a
Deleted 1 'Copy Pods Resources' build phases.
Deleted 1 'Check Pods Manifest.lock' build phases.
- libPods.a
Deleted 1 'Copy Pods Resources' build phases.
Deleted 1 'Check Pods Manifest.lock' build phases.
- libPods.a
Deleted 1 'Copy Pods Resources' build phases.
Deleted 1 'Check Pods Manifest.lock' build phases.
- libPods.a
- libPods.a
Deleted 1 empty `Pods` groups from project.
Removing `Pods` directory.
Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.
Updating local specs repositories
Analyzing dependencies
[!] The dependency `AFNetworking (= 2.6.3)` is not used in any concrete target.
The dependency `MBProgressHUD (~> 0.9.1)` is not used in any concrete target.
The dependency `PDKeychainBindingsController (~> 0.0.1)` is not used in any concrete target.
The dependency `FMDB/SQLCipher` is not used in any concrete target.
The dependency `ZXingObjC (~> 3.1.0)` is not used in any concrete target.
The dependency `SDWebImage (~> 3.7.2)` is not used in any concrete target.
The dependency `SignalR-ObjC (~> 2.0.0.beta3)` is not used in any concrete target.
The dependency `CJPAdController (from `https://github.com/nabeelarif100/CJPAdController.git`)` is not used in any concrete target.
The dependency `ECSlidingViewController (~> 2.0.3)` is not used in any concrete target.
The dependency `VGParallaxHeader` is not used in any concrete target.
The dependency `EMString` is not used in any concrete target.
The dependency `Google/SignIn` is not used in any concrete target.
The dependency `VIPhotoView (~> 0.1)` is not used in any concrete target.
The dependency `EncryptedCoreData (from `https://github.com/project-imas/encrypted-core-data.git`)` is not used in any concrete target.
MacBook-Pro:iOS-TuneIn home$
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'AFNetworking', '2.6.3'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'PDKeychainBindingsController', '~> 0.0.1'
pod 'FMDB/SQLCipher'
pod 'ZXingObjC', '~> 3.1.0'
pod 'SDWebImage', '~>3.7.2'
pod 'SignalR-ObjC','~>2.0.0.beta3'
pod 'CJPAdController', :git => 'https://github.com/nabeelarif100/CJPAdController.git'
pod 'ECSlidingViewController', '~> 2.0.3'
pod 'VGParallaxHeader'
pod 'EMString'
pod 'Google/SignIn'
pod 'VIPhotoView', '~> 0.1'
pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'
You have to specify a target for each pod.
e.g. if before you had your Podfile written like this:
pod 'Alamofire', '~> 3.1.4'
pod 'SwiftyJSON', '~> 2.3.2'
just change it to
target "TargetName" do
pod 'Alamofire', '~> 3.1.4'
pod 'SwiftyJSON', '~> 2.3.2'
end
After the new changes to cocoapods, You have to add the following lines to your podfile.
target "YOUR_PROJECT_NAME" do
pod "YOUR_POD"
end
From the CocoaPods website:
CocoaPods provides a pod init command to create a Podfile with smart defaults. You should use it.
you must add target 'your target' do and end around you pod like below.
target 'your target' do
pod 'AFNetworking', '2.6.3'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'PDKeychainBindingsController', '~> 0.0.1'
end
plus: You may be need remove the pods dir, Podfile.lock and xcworkspace file, run the pod install again.
I got the same issue today. For mitigation, I unintall cocoapod, then install again version 0.39.
here is the link how to uninstall: https://superuser.com/questions/686317/how-to-fully-uninstall-the-cocoapods-from-the-mac-machine
This answer does not fix the root cause, but can get you unblocked. I don't have enough reputation to leave comments, so I put an answer here to unblock you.
I was this operation in the podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target "targetprojectname" do
pod "AFNetworking"
end
My podfile was formatted correctly, so the answer did not work for me. What I had to do was all of the following:
First,
gem uninstall cocoapods
rvm get stable --auto-dotfiles
rvm use ruby-2.1.2
rvm osx-ssl-certs update all
rvm rubygems latest
sudo gem sources -r https://rubygems.org/
sudo gem sources -a http://rubygems.org/
gem install cocoapods -v 1.0.0.beta.1 --pre -V
I had SSL errors, timeout errors, and path errors. This fixed all of these. I am adding this answer in hopes that it will help someone - most people with this issue will NOT need to go through all of these steps, and should not do so if it is not neccesary. Keep in mind, that this is changing the d/l link to not use https, so be sure to change it back once you have resolved this issue. This, this, and this Stack Overflow question helped me finally resolve these issues.
I have the same problem, and even I changed to
target "TargetName" do
pod 'Alamofire', '~> 3.1.4'
pod 'SwiftyJSON', '~> 2.3.2'
end
It seems has some cache problem, it always read old version of PodFile, even I remove PodFile, the same error show up. It's weird.
However, when I open a new terminal , running pod install, it works.
1) Add and Open Podfile in Xcode instead of TextEdit or any other editor. (Syntax highlighting while viewing a pod file will simplify the process of finding syntax errors)
2) Add project dependancies as follows in your Podfile
def pods
pod 'AFNetworking', '~> 2.6'
pod 'ORStackView', '~> 3.0'
pod 'SwiftyJSON', '~> 2.3'
end
3) Add above define pods in project target as follows
target 'App_Target_Name' do
pods
end
for New version of cocoapods i.i 1.0.1
pod 'SlideMenuControllerSwift'
pod 'SDWebImage'
pod 'SearchTextField'
I was getting error:
The dependency SlideMenuControllerSwift is not used in any concrete target.
The dependency SDWebImage is not used in any concrete target.
The dependency SearchTextField is not used in any concrete target.
than i changed it to
target "YOUR_PROJECT_NAME" do
pod "YOUR_POD"
end
than it worked
Pod file is just a ruby file, you need to specify required pod for all target.
one of the available solution is to define all required pods in shared_pos, and use that for each target.
For ex:
Podfile
platform :ios, '9.0'
use_frameworks!
def Shared_Pods
pod 'Quick', '0.5.0'
pod 'Nimble', '2.0.0-rc.1'
end
target 'MyMainTarget' do
Shared_Pods
end
target 'MyUITests' do
Shared_Pods
end
platform :ios, '8.0'
target 'YourTargetName' do
ALL PODS HERE
end
open terminal, go to project folder and enter code
pod update

Resources