Swift project with Cocoapods dependencies - ios

I have the following cocoapods Podfile
platform :ios, '8.0'
use_frameworks!
target 'Foo' do
pod "SwiftyJSON", '~> 2.2.0'
pod "Locksmith"
pod "GoogleMaps"
pod "RealmSwift"
end
target 'FooTests' do
end
I'm also using cocoapods 0.37.2. For some reason, when I try to run the app, it complains with the following error, when clearly I have specified that my project requires SwiftyJSON 2.2.0 or greater:
Reason: Incompatible library version: Foo requires version 2.0.0 or later, but SwiftyJSON provides version 1.0.0
I have verified that there's no other dependencies on SwiftyJSON (using cocoapods-dependencies):
$pod dependencies
Dependencies
---
- GoogleMaps (1.10.1)
- Locksmith (1.2.2)
- Realm (0.93.2):
- Realm/Headers (= 0.93.2)
- Realm/Headers (0.93.2)
- RealmSwift (0.93.2):
- Realm (= 0.93.2)
- SwiftyJSON (2.2.0)
As you can see, no one is pulling SwiftyJSON 1.0.0. By the way, the reason I'm using cocoapods 0.37.2 is because of this bug when I tried to use 0.38.1: https://github.com/CocoaPods/CocoaPods/issues/3890.
Have I missed anything here (regarding the SwiftyJSON version mismatch) ? I've tried cleaning the project, redoing pod install, etc without any luck..
Thanks in advance!

For me (and for you it seems), the following worked:
Remove guilty pods from podfile (in my case, AFNetworking and AFNetworkActivityLogger)
pod install to wipe them out
Upgrade (or downgrade if you're on 0.38.1) to cocoapods 0.38.0
Add pods back & pod install
Now I'm back in business... I believe 0.38.1 was responsible for getting me into this mess.

Related

Cocapods Updating Firebase instead of installing v 11 reverts to old version v3.6

I have inherited a project that has not been updated for a while. It uses Firebase SDK with Coapods. Latest version of Cocapods currently is Version 10.0.0 - October 10, 2022 ([https://firebase.google.com/support/release-notes/ios][1])
My Podfile looks like this
platform :ios, '11.0'
target 'AppName' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for AppName
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
As you can see I do not limit versions with ~> notation.
When I run pod update Firebase in terminal I get
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing Firebase 3.6.0
Installing Firebase 7.3.0 (was 3.6.0)
Installing GoogleUtilities 1.3.2
Installing GoogleUtilities 7.8.0 (was 1.3.2)
Generating Pods project
Integrating client project
Pod installation complete! There are 29 dependencies from the Podfile and 65 total pods installed.
So why does it not update to the version 11?
Why is this line here -> Installing Firebase 3.6.0 ?
Also I get bunch of warnings like:
[!] Unable to read the license file `LICENSE` for the spec `Firebase (7.3.0)`
[!] Unable to read the license file `LICENSE` for the spec `GoogleUtilities (7.8.0)`
[!] Unable to read the license file `LICENSE` for the spec `Firebase (7.3.0)`
[!] Unable to read the license file `LICENSE` for the spec `GoogleUtilities (7.8.0)`
[!] [Xcodeproj] Generated duplicate UUIDs
How do I make it to update to version 11? And without bunch of warnings? Any idea where to start?
[1]: https://firebase.google.com/support/release-notes/ios

Unity fails to compile project with firebase analytics because of Cocoapods

I'm trying to integrate Firebase-Analytics in my Unity 2013.3.1 project.
After following the integration guide, I've tried to build the project.
However, Unity fails to build. The reason seems to be cocoapods.
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Firebase/Analytics":
In Podfile:
Firebase/Analytics (= 4.8.1)
None of your spec sources contain a spec satisfying the dependency: `Firebase/Analytics (= 4.8.1)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
I've tried to reinstall cocoapods and re-run pod setup, and also deleting the repo and re-setupping using rm -rf ~/.cocoapods/repos/master, but I had no success.
Here's the generated Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
target 'Unity-iPhone' do
pod 'Firebase/Analytics', '4.8.1'
pod 'Firebase/Core', '4.8.1'
end
One last thing I've tried was to remove the specific version tags into the Podfile (I've removed the '4.8.1'). This fixed the pod install, however I couldn't find a way to have a successfull build from unity, since the Podfile is auto-generated.
Here's the pod install output after removing the version tag:
Analyzing dependencies
Downloading dependencies
Installing Firebase (4.9.0)
Installing FirebaseAnalytics (4.0.9)
Installing FirebaseCore (4.0.15)
Installing FirebaseInstanceID (2.0.9)
Installing GoogleToolboxForMac (2.1.3)
Installing nanopb (0.3.8)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `Unity-iPhone.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 6 total pods installed.
It looks like FirebaseAnalytics is currently at version 4.0.9, not 4.8.1.
Did anyone have similar issues?
Update to the 4.4.2 release.
Or to workaround with 4.4.1:
Manually edited each of Dependencies.xml files in Assets/Firebase/Editor to change the version from 4.8.1 to 4.8.2. Example:
<iosPods>
<!-- Mike changed this from 4.8.1 to 4.8.2 -->
<iosPod name="Firebase/Analytics" version="4.8.2" minTargetSdk="7.0">
</iosPod>
</iosPods>
Reference and additional detail here.
The version of FirebaseAnalytics used by Firebase 4.9 is 4.0.9, not 4.8.1. See the podspec for reference.
Another possible issue for failing is that your dependency (iOS 7) is too old and it's not supported by Xcode 9, nor by the latest version of Firebase.
Replace
platform :ios, '7.0'
with
platform :ios, '8.0'

GoogleMaps not being updated to 1.13

I am trying to get the latest version of GoogleMaps SDK. I use cocoapods, I tried 'pod update'
where I had pod 'GoogleMaps', '~> 1.13' in the podfile, but I am getting
[!] Unable to satisfy the following requirements:
GoogleMaps (~> 1.13) required by Podfile
I also tried to only place pod GoogleMaps in my podfile but I get an older version.
Using GoogleMaps (1.10.3)
I also tried pod try GoogleMaps
and I am getting an older version
After updating cocoapods using rm -rf ~/.cocoapods and then pod setup I was able to gt the latest version of GoogleMaps using pod update without changing anything in the podfile.

No Parse Framework in Pods folder after a pod install with cocoapods

I'm trying to import Parse SDK with cocoapods (version 0.37.2). I have recentl but right after doing a pod install There is no Parse.framework in the Pod folder...
When I try to build the app, it failed because with it doesn't find the parse.h from #import <Parse/Parse.h> in the bridging header file (which is quite normal because there is no Parse Framework).
Is this possible that as I previously used Parse for another project, when my computer downloads it, it changes the name, such as Parse.framework(2) and then the system can't retrieve it...
Here are the messages from terminal right after the pod install (which look good):
Analyzing dependencies
Downloading dependencies
Installing Bolts 1.2.0 (was 1.2.0)
Installing Parse 1.7.5 (was 1.7.5)
Generating Pods project
Integrating client project
And this is what the podfile looks like :
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
`pod 'Parse', '~> 1.7.5'``
Last point: I have recently upgraded my version of rbenv (from 2.1.2 to 2.2.2) and as Cocoapods is in ruby, I am wondering there could be a link....
Any help would be grateful !
Thanks
What is your version of your cocoapods?
If you are using 0.38.0, it might be changes of CocoaPods make the spec fail. Try to replace
pod 'Parse', '~> 1.7.5'
with
pod 'Parse', podspec: 'https://gist.githubusercontent.com/siuying/6a548f1924ed3243aeb5/raw/ccea130108b14afbaf22dbe828f75a62d750a4a0/Parse.podspec.json'
and see if it works for you.
If your "Objective-C Bridging Header" in project level it's possible to get this error. You should set this in target level! After added in your target please don't forget to remove from project level. This must solve your problem, I solve like this.

Using pods with conflicting AFNetworking dependencies

I'm trying to use two pods--JGAFImageCache and ADNKit--that specify different versions of AFNetworking. Here's my Podfile:
platform :ios, '7.0'
pod 'AFNetworking'
pod 'ADNKit'
pod 'JGAFImageCache'
pod 'DerpKit'
pod 'SVProgressHUD'
pod 'SSKeychain'
pod 'iOS7Colors', '~> 2.0.0'
When running pod install, I get this message:
[!] ADNKit (1.3.1) tries to activate AFNetworking (~> 1.3.0)', but already activated version2.0.0-RC3' by Podfile, AFNetworking (2.0.0-RC3), AFNetworking/Core (2.0.0-RC3), AFNetworking/Core (2.0.0-RC3), AFNetworking/Core (2.0.0-RC3), and AFNetworking/Core (2.0.0-RC3).
Removing AFNetworking and relying on v1.3.0 in ADNKit results in this:
[!] JGAFImageCache (1.1.0) tries to activate AFNetworking (~> 1.2.0)', but already activated version1.3.3' by ADNKit (1.3.1).
I'd be happy working with v1.3.1; I don't need the latest version of AFNetworking.
How do I get JGAFImageCache and ADNKit to stop fighting over which version of AFNetworking to use?
Obviously, your best bet is to file an issue with those developers to use up to date dependencies. The problem is that those pods rely on AFNetworking's API to not change, so there could be issues if you try to use a later version and some of the API has been removed.
Another approach would be to fork those repos and then change the dependencies within the podfiles yourself so that they are both using the same dependency. Then you'd just point your app's podfile to install them from your forked repo. This could break something, so you'll have to check for yourself and it's obviously not a good long term solution.
pod 'ADNKit', :git => 'https://github.com/yourUsername/ADNKit.git'

Resources