CocoaPods issues while adding a new pod - ios

My CocoaPods works fine until I try to install a new one.
If I try to install a new pod, then there are several issues in charts pod, else it works fine.
How do I fix it?
The errors show up as below:
My podfile is as below:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
target 'Tranquil' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# Pods for TranquillocationText
pod 'GooglePlaces'
pod 'UICircularProgressRing'
pod 'Alamofire', '~> 4.0' . //if i try to add this pod then error occurs
pod 'Charts'
end

Note: Ensure swift language version of your project. Here is how you can see/check your swift language version.
You have two options as solution to your query:
If your project has Swift versio 4.0 - You should choose/download POD compatible to your project's swift language (Share me POD info and swift version, so I can provide you exact pod version version for your pod library suitable for project).
If your project has swift version below 4.0 - You need to migrate your project into Swift 4.0 (if you've not migrated it). Here is ref question and answer, how to migrate from swift (below) <4.0 to 4.0.
Xcode 9 Swift Language Version (SWIFT_VERSION)
According to snapshot added by you in your question - Swift 3.x is your current project language version and pod 'Charts' is supporting swift 4.
pod 'Charts'
Here is list of previous release supporting Swift version below 4.0.
https://github.com/danielgindi/Charts/releases
Try previous release of cosmos like:
pod 'Charts', '~> 3.0.3'
// or
pod 'Charts', '~> 3.0.2'
// or
pod 'Charts', '~> 3.0.1'
'
Similar way you can find previous release of Alamofire (supporting Swift below 4.0) from here - Alamofire - Releases
Try this with Swift 3.2 and see:
platform :ios, '9.0'
use_frameworks!
target 'Tranquil' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# Pods for TranquillocationText
pod 'GooglePlaces'
pod 'UICircularProgressRing', '~> 1.7'
pod 'Alamofire', '~> 4.0'
pod 'Charts', '3.0.3'
pod 'SwiftyJSON', '3.0.0'
end

Go to build settings of the target 'Tranquil' then to the section 'Swift Language Version' and set it to 'Swift 4.0'. Next, reinstall your pods with a command 'pod install'. Next, rebuild your project.

Related

Swift 4.2 - Getting compiler errors for bridging header files missing in FacebookCore. Any ideas?

So I recently converted an old swift 3.2 project to a 4.2(quite the jump, i know).
I am getting these errors:
Here is my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'app' do
pod 'Alamofire', '~> 4.0'
pod 'EVReflection/XML'
pod 'FontAwesomeKit', :git => 'https://github.com/PrideChung/FontAwesomeKit.git'
pod 'SVProgressHUD'
pod 'PageMenu', :git=> 'https://github.com/orazz/PageMenu.git'
pod 'Kingfisher', '~> 3.0.0'
pod 'RichEditorView'
pod 'SwiftKeychainWrapper'
pod 'FacebookCore'
pod 'CHTCollectionViewWaterfallLayout/Swift'
pod 'FacebookLogin'
pod 'FacebookShare'
pod 'Fuzi', '~> 1.0.0'
end
does this look correct?
Thank you for any insights
First, run pod install
And then, check if the version of your pods, probably they are not compatible with Swift 4.2, so you have to update then, or change the "Swift language version" on Pod inspector to swift 3.2 like that way:
Select the "Pod" project in project navigator:
Select your pod on Targets selector:
And on "Build settings" tab, find and change the "Swift language version" property:
Note: You can get away of this problem this way, but i highly recommend that you update your pods.

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

CleverTapSDK module not found

I am using various Swift and Objective-C libraries in my (Swift) project. My Podfile looks as follows:
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
pod 'Fabric'
pod 'TwitterKit'
pod 'SimpleAuth/Instagram'
pod 'AFNetworking', '~> 3.0'
pod 'Parse'
To have support for using both (Swift and Objective-C) libraries, I use use_framework! directive in Podfile to install and use them. If we use directive use_framework! for Objective-C libraries, we are not required to create any kind of bridging-header.h and we can use it directly by import ModuleName. I am having no issues with any of the above mentioned pods/frameworks while installing or using them.
But there is this one framework which is written in Objective-C and I install it by adding its entry in Podfile as pod 'CleverTap-iOS-SDK'. The installations goes well but when I try to import CleverTapSDK or import CleverTap to use the library, it is giving me no such module error.
Just in case: My Xcode version is - 7.3 (7D175)

Cocoapods framework not found - mixed objective c and swift pods

tl;dr; how to use old (what shouldn't use use_frameworks!) and new pods together in podfile?
I had working podfile:
platform :ios, '8.0'
use_frameworks!
target 'myApp' do
pod 'Alamofire', '1.3.1'
pod 'SwiftyJSON', '~> 2.2.1'
end
Then I added OneSignal pod according to documentation link
So my pod file changed to:
platform :ios, '8.0'
use_frameworks!
target 'myApp' do
pod 'Alamofire', '1.3.1'
pod 'SwiftyJSON', '~> 2.2.1'
pod 'OneSignal'
end
I updated pods and run build - got error:
ld: framework not found OneSignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked OneSignal pod and it looks differently compared to others:
Thats probably because is old style objective-c framework.
I can add this framework manually to my project but I wonder how to make it work properly with cocoapods?
This issue relates to my problem I think https://github.com/CocoaPods/CocoaPods/issues/3338
Update
I'm currently using Xcode 6.4
What version of Xcode are you using?
If update to the latest release versions of both Alamofire and SwiftyJSON and build with Xcode 7 it should fix your build errors.
platform :ios, '8.0'
use_frameworks!
target 'myApp' do
pod 'Alamofire', '2.0.2'
pod 'SwiftyJSON', '~> 2.3.0'
pod 'OneSignal'
end

Error running pod install with swift

I followed the instruction from Cocoapods.
Below is my Podfile:
platform :ios, '8.2'
pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan
When I did pod install I got the following error:
Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add use_frameworks! to your Podfile or target to opt into using it.
Updated:
Below is my console log:
$ pod install
Analyzing dependencies
Downloading dependencies
Installing Alamofire (1.1.4)
Installing SuperRecord (1.2)
Installing SwiftSpinner (0.6.0)
Installing SwiftyJSON (2.1.3)
Installing Toucan (0.2.0)
[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.
Add "use_frameworks!" to your Podfile:
Please see below sample Podfile
target 'MySample' do
pod 'AFNetworking', '~> 2.5'
pod 'Net', '~> 0.2' #This is a sample in Swift
use_frameworks! # <--Use this line
end
Add "use_frameworks!" to your Podfile because:
Because Apple doesn't let you build static libraries that contain
Swift. Unlike Objective-C, Apple doesn't ship the Swift standard
runtime libraries with iOS. This decouples the language version from
the platform version. When you build an app with Swift, you're
responsible yourself to ship them. By default, Xcode uses
swift-stdlib-tool to handle copying the Swift runtime dylibs, but the
tooling falls short when attempting to ship frameworks that use Swift
with an app that is Objective-C only. Your app executable and the
frameworks you ship will all use the same set of dylibs, which are
embedded into the Frameworks subdirectory of the application bundle.
First, that's because you can't link against different versions of the
standard libraries. Furthermore it is desirable to embed them only
once and not multiple times, because of constraints to memory size and
network speed, which are relevant for distribution.
You can make CocoaPods integrate to your project via frameworks
instead of static libraries by specifying use_frameworks!. If that's
not present, you won't be able to integrate dependencies, if you
depend on a pod which includes Swift source code.
Reference: http://blog.cocoapods.org/CocoaPods-0.36/
as it written in Podfile it says uncomment use_frameworks! is your are using Swift so all you have to do uncomment this line and all works just fine
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'YourProjectName' do
pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan'
# all other pods goes here
end
target 'YourProjectName' do
end
target 'YourProjectName' do
end
the solution is very simple. You only have to add these lines to your pod file:
target 'PassDTAFirebase' do
inherit! :complete
# Here your pods
use_frameworks!
end
I my case i used to upgrade cocoapods by command sudo gem install cocoapods and my issue got resolved. I used objective - c as well as swift libraries in my project.

Resources