Adding Cocoapods To Multiple Targets - ios

I'm needing to add Alamofire to my main iOS app and the iOS Today Extention. With Alamofire just being in my iOS app target, it works great! But now, I'm trying to add Alamofire to my today extention. This is my Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'The Main iOS App' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Canvas'
pod 'Firebase/Core’
pod 'Firebase/Messaging’
pod 'Alamofire', '~> 4.4'
# Pods for The Main iOS App
end
target 'Today' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire', '~> 4.4'
# Pods for Today
end
Whenever using pod install in terminal, I get this:
Analyzing dependencies
Downloading dependencies
Using Alamofire (4.5.0)
Using Canvas (0.1.2)
Using Firebase (4.0.3)
Using FirebaseAnalytics (4.0.2)
Using FirebaseCore (4.0.3)
Using FirebaseInstanceID (2.0.0)
Using FirebaseMessaging (2.0.0)
Using GoogleToolboxForMac (2.1.1)
Using Protobuf (3.3.0)
[!] The 'Pods-iFunnyVlogger' target has frameworks with conflicting names: alamofire.
How do I properly do this?
UPDATE - Still Not Working
Some information that you may need is that I'm on cocoapods version 1.2.0 and I've tried pod update, but I'm still getting that error
[!] The 'Pods-iFunnyVlogger' target has frameworks with conflicting
names: alamofire.

Try this
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
def other_pods
pod 'Canvas'
pod 'Firebase/Core’
pod 'Firebase/Messaging’
end
def shared_pods
pod 'Alamofire', '~> 4.4'
end
target 'The Main iOS App' do
shared_pods
other_pods
end
target 'Today' do
shared_pods
end

Related

How to temporarily lock to FirebaseInstanceID 2.0.0

I have been facing issues in sending push notification to IOS clients who are running in IOS 11, on surfing the internet found that temporarily lock to FirebaseInstanceID 2.0.0 in the pod file.But if i do that i am getting the error message as follows,
**Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "FirebaseInstanceID":
In snapshot (Podfile.lock):
FirebaseInstanceID (= 2.0.10)
In Podfile:
FirebaseInstanceID (= 2.0.0)
Specs satisfying the `FirebaseInstanceID (= 2.0.0), FirebaseInstanceID (= 2.0.10)` dependency were found, but they required a higher minimum deployment target.
[!] Automatically assigning platform `ios` with version `10.2` on target `PushNotificationDemo` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.**
FCM Push notifications do not work on iOS 11
Is there any other way of enabling push notifications in IOS 11.Thanks in advance
My Pod file as below,
Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'PushNotificationDemo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for PushNotificationDemo
pod 'Firebase/Core'
pod 'Firebase/Messaging'
#pod 'FirebaseInstanceID', '2.0.0'
target 'PushNotificationDemoTests' do
inherit! :search_paths
# Pods for testing
end
target 'PushNotificationDemoUITests' do
inherit! :search_paths
# Pods for testing
end
end

Installing GeoFire with cocoapods

I am currently trying to set up GeoFire with my Firebase project and have a podfile like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target '[Appname]' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for [Appname]
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'GeoFire', '~> 1.1'
end
However, running a pod install command gives this error:
[!] Unable to satisfy the following requirements:
Firebase (~> 2.1) required by GeoFire (1.1.0)
Specs satisfying the Firebase (~> 2.1) dependency were found, but they required a higher minimum deployment target.
I can't figure out how to get GeoFire installed. Isn't GeoFire compatible with the new Firebase?
Solution
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

Duplicate interface definition of class Parse

I just updated my cocoa pods library and when I compile the project I am getting the error.
Duplicate interface definition of class Parse
Here is my Podfile
platform :ios, '7.0'
use_frameworks!
target 'Alfred' do
pod 'Stripe'
pod 'SDWebImage', '~>3.7'
pod 'Parse'
pod 'ParseFacebookUtils'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'CMMapLauncher'
pod 'Fabric'
pod 'Crashlytics'
pod 'SinchVerification', '0.9-beta1'
pod 'TWMessageBarManager'
pod 'MaterialControls', '~> 1.0.2'
pod 'PubNub/Fabric'
end
Any clue on this?
Update
This are the version of each library
Using Bolts (1.7.0)
Using CMMapLauncher (1.1.0)
Using CocoaLumberjack (2.2.0)
Using Crashlytics (3.7.0)
Using FBSDKCoreKit (4.10.1)
Using FBSDKLoginKit (4.10.1)
Using Fabric (1.6.7)
Using Facebook-iOS-SDK (3.24.4)
Using MaterialControls (1.0.2)
Using Parse (1.13.0)
Using ParseFacebookUtils (1.10.0)
Using PubNub (4.3.0)
Using SDWebImage (3.7.5)
Using SinchVerification (0.9-beta1)
Using Stripe (6.2.0)
Using TWMessageBarManager (1.8.1)
Ok I fixed it this way:
for objC
just remove use_frameworks! or comment it #use_frameworks!
then clean, build, and run..

Google Analytics v3 Pod with other Swift Pods

I'm developing an swift iOS app and at this "final" stage I'll add Google Analytics.
I'm following their Guide
But it failed at pod install command...
Error Log
Downloading dependencies
Using Alamofire (1.2.2)
Using Bolts (1.2.0)
Using CryptoSwift (0.0.10)
Using FBSDKCoreKit (4.2.0)
Using FBSDKLoginKit (4.2.0)
Using FBSDKShareKit (4.2.0)
Installing Google (1.0.7)
Installing GoogleAnalytics (3.13.0)
Using GoogleMaps (1.10.1)
Installing GoogleNetworkingUtilities (1.0.0)
Installing GoogleSymbolUtilities (1.0.0)
Installing GoogleUtilities (1.0.1)
Using ImageLoader (0.3.2)
Using SQLite.swift (0.1.0.pre)
Using SwiftyJSON (2.2.0)
[!] The 'Pods-<My-Project>' target has transitive dependencies that include static binaries: (<path-to-project-dir>/Pods/Google/Libraries/libGGLAnalytics.a, <path-to-project-dir>/iOS/Pods/Google/Libraries/libGGLCore.a, <path-to-project-dir>/iOS/Pods/GoogleAnalytics/Libraries/libGoogleAnalytics.a, (...)
As stated in this tutorial, "pods written in Swift must be created as dynamic frameworks" (and that's why the use_frameworks! in the Podfile).
As it seems, this new Google Analytics pod is a static binary.
I tried to change the pod the same as this answer but the pod install command warned me that (obviously) [!] GoogleAnalytics-iOS-SDK has been deprecated in favor of GoogleAnalytics. And I'm not sure it's a good idea to add an already deprecated library to a new project instead of getting the right one to work.
My project has a target dependecy to iOS 8.0+ and the podfile is:
```
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'MyProject' do
pod 'Alamofire', '~> 1.2'
pod 'SwiftyJSON', '~> 2.2.0'
pod 'GoogleMaps'
pod 'ImageLoader', '~> 0.3.0'
pod 'SQLite.swift', git: 'https://github.com/stephencelis/SQLite.swift.git'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'CryptoSwift'
pod 'GoogleAnalytics', '~> 3.13'
end
target 'MyProjectTests' do
end
```
Is anyone having the same problem or know how to solve this using the v3 GA pod?
Replace the line
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
in your Podfile with
pod 'GoogleAnalytics', '~> 3.13'
Clean project and run pod install again. The pod you're currently using is the one that is deprecated.

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