Alamofire not working after upgrading (Swift/Xcode 8) - ios

My earlier version of swift was in 2.2.
I have updated Alamofire using different options like
pod 'Alamofire', '~> 4.0'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'
Whenever I open the workspace, it asks to convert to latest, I opted for swift 2.3. But the Xcode shows the errors below:
Header 'Alamofire-Swift.h' not found
Could not build Objective-C module 'Alamofire'
and inside Alamofire
Cannot convert value of type 'SecTrustResultType' to expected argument type 'UInt32'
I have deleted the files under the folders ~/Library/Developer/Xcode/DerivedData and build again . Same errors display.
What may be the wrong thing I did ?

As per Alamofire documentation it will work only with :
CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+.
I followed following steps and it's working fine :
Open your terminal -
sudo gem update --system
sudo gem install -n /usr/local/bin cocoapods --pre (It will install prerelease version 1.1.0.rc.3 because final version not came yet)
pod setup
pod repo update
remove all pods of your project and install it again ( Comment pod names by # -> Do pod update and again by removing # -> Do pod update )

Related

Flutter: CocoaPods could not find compatible versions for pod "Firebase"

I have been working on update for a Flutter app that uses Firebase Firestore, once I finished the updated and starting to build it for IOS, I got the following error message which cause the build operation to fail:
[!] CocoaPods could not find compatible versions for pod "Firebase/Auth":
In snapshot (Podfile.lock):
Firebase/Auth (= 9.3.0)
In Podfile:
firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) was resolved to 3.3.12, which depends on Firebase/Auth (= 8.14.0)
Note: The error message in the question says Firebase/Auth package but it also happened with other Firebase packages.
So what should I do to get over this problem?
i had the same error but the correct answer didnt work for me so i deleted the Pod.lock file and applied this steps.
so this The Solution worked for me:
Cocoa Pods Installation in M1
sudo gem install cocoapods
sudo gem install ffi
arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods -n /usr/local/bin
Install ffi
sudo arch -x86_64 gem install ffi
#update repo
arch -x86_64 pod install --repo-update
Flutter iOS builds
flutter clean
flutter build ios
my answer is based on this answer
Since you mentioned that you are using Firebase Firestore in your app, then you case might be the same of mine.
In the official docs of Firebase Firestore for Flutter, you will notice an Optional step that tells you to add a line in the Podfile to improve iOS & macOS build times by including the pre-compiled framework, like this one:
target 'Runner' do
...
# This is the mentioned line
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
...
end
The solution for me was to update the tag number in the link in the line with the latest one from the repository on GitHub. Which repo? the one in the line.
At the dropdown that lets you select the branch you will find a tab for selecting a tag, just tap it and check the latest version number and use it in the line, e.g. The latest version for the time of this answer is 9.3.0, so the line would be:
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.3.0'
If it did not work, then you may totally ignore this optional step and remove this line from the Podfile. The build operation would take longer than before but it is better than a build failure.
What worked for me was running pod repo update from the XCode app directory ("ios/app" for capacitor apps) and then the pod install command.
If you are using such a line in your podfile
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0'
then you need to check the repo's latest version from here to keep your pub.dev firebase packages compatible :
pre-compiled framework version

CocoaPods could not find compatible versions for pod "Firebase/Crashlytics"

I am developing react-native app.
I followed the firebase instruction adding my iOS app to my firebase project.
In my Podfile, I have:
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
when I run pod install I keep getting the error saying "CocoaPods could not find compatible versions for pod "Firebase/Crashlytics".
Xcode version 11.7, target iOS10.1
Why I get that error and how to get rid of it?
(I tried run pod update 'Firebase', I get:
[!] The Firebase Pod is not installed and cannot be update)
Make sure that your project's minimum deployment target (the one that referenced in your Podfile) is at least iOS 9 (see Firebase/Crashlytics release notes)
Unfortunately when cocoapods initially create the Podfile, doesn't take into account your projects minimum deployment target. Instead adds a default value in a comment.
The first time that you run pod install you will get a warning about not specified minimum deployment target. Also cocoapods documentation doesn't mention anything regarding this behavior.
So, you have to have to manually edit your Podfile and add something like this:
platform :ios, '10.1'
No issue with the deployment target but got the same error. It was working with the following versions of Firebase
pod 'Firebase/Core', '~> 3.0.0'
pod 'Firebase/Crashlytics', '~> 7.0.0'
When I added a new dependency and run pod install, It was showing the error for Firebase. So, I used the >= 0 in place of the version.
pod 'Firebase/Core', '>= 0'
pod 'FirebaseCrashlytics', '>= 0'
This will install the latest version for all Firebase dependencies.

Alamofire install failed - Xcode 8.1

Recently upgraded to XCode 8.1 trying to install Alamofire pod for a new project. Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'app' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for app
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'swift3'
end
And my terminal responds:
image
so what can I do?
--Update--
also tried pod 'Alamofire', '~> 4.0'
here is the result
I did the pod repo update it doesn't do anything at all
Edit your podFile as below and just install the pods using pod install --verbose command if still error exists then update your repo with pod repo update then try again.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'app' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for app
pod 'Alamofire'
end
As per the discussion here,
You need to use
pod 'Alamofire', '~> 4.0'
In your pod file
I faced the same problem when i updated the mac os from el capitan to sierra and installed new version of Xcode.
I updated the cocoapod and still, was facing the same problem.
I found a solution by completely removing cocoapod from root directory and installing it again.
To remove the cocoapod completly use this in terminal
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
and then install the cocoapod again
$ gem install cocoapods

Firebase CocoaPods Installation Not Working

I'm trying to install Firebase via CocoaPods for my Objective-C iOS Application. My Podfile is as follows:
target 'RandomName' do
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
When I run pod install, I get the following error:
[!] Unable to satisfy the following requirements:
- `Firebase/Core` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Firebase/Core`.
You have either:
* out-of-date source repos which you can update with `pod 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.
The latest version of CocoaPods is installed, and I have tried running pod repo update. Having a Podfile of the following works fine, but when I try to #import Firebase; in my AppDelegate.m file, Xcode cannot find the module.
target 'RandomName' do
pod 'Firebase'
end
However, the following combination does not install:
target 'RandomName' do
pod 'Firebase'
pod 'Firebase/AdMob'
end
Any help would be appreciated!
Check what version of Firebase is installed when you use pod 'Firebase'. For me it installs 2.4.3 which is an old version. The docs say that the pod should install 3.2 using that pod. It explains why the other pods don't work as they are part of Firebase 3. Pod update doesn't update Firebase to the latest version either. Even forcing a version doesn't work. It can't seem to find the new Firebase versions even though they are in the same podspec.
Here is how I solved it:
make sure you have the latest version of git installed
make sure you have cocoapods >= 1.0.0 installed
delete your pods repo (run pod repo remove master) and use pod setup to make a new one
use the following in your pod file
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Core'
(use whatever you want, just don't use 'Firebase')
pod install
everything should install properly
Running 'pod repo remove master' to remove the Pods repo //removes the library
Running 'pod setup' //clones the updated git repo for specs which takes long time as its size is beyond 300K (Be patient!)
Running 'pod install' //problem is solved
have you tried to add
frameworks
use_frameworks!
after target 'RandomName' line
and adding
platform :ios, '9.0'
before target ....
A couple of items to try. From your question, you did try the first two items, but leaving here for completeness of my answer.
The error response you get is helpful. Follow the steps for pod repo update
Make sure your pod is up to date.
pwd> pod --version
1.0.0
Make certain that your git is up to date. I had a build machine that had an outdated git (1.7), and I had the same exact error
-
When I updated to this version from git 1.7 it worked fine.
pwd> git --version
git version 2.8.1
My Podfile for using Firebase Dynamic Links
run pod init from the folder where your .xcodeproj is
Be sure to only launch the .xcworkspace instead of the .xcodeproj from here out.
platform :ios, '8.0'
use_frameworks!
target 'the-name-of-target' do
pod 'Firebase/DynamicLinks'
end
The Same problem occurred while on pod install command.
Please relaunch terminal and navigate to your Xcode project then
simply fire same pod install command. 'Firebase/Database' will installed successfully :)
I just doing following step to fix this error:
$pod setup -- verbose
Then do $pod install
that works for me and my pod file is:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'the-name-of-target' do
pod 'Eureka', '~> 1.6'
end
UPDATE:
Then you can remove your master and re-install cocoapods using following code:
cd ~/.cocoapods/repos
rm -rf master
pod setup
I had the same error, and my solution was to downgrade Cocoapods to 1.0.0, because Cocoapods 1.0.1 didn't work as I expected. Everything works great now!
sudo gem uninstall cocoapods -v 1.0.1
sudo gem install cocoapods -v 1.0.0
My Podfile:
platform :ios, '8.0'
target 'XXX' do
pod 'Firebase/Auth'
pod 'Firebase/Database'
end
For people still having problems with this. When directly coping the firebase walkthourgh website, the install string is:
pod `Firebase/Core`
While it should have been:
pod 'Firebase/Core'
No need for pod setup if this applies to you too.
Update Git and Cocoapods to the last version:
Git: $ brew update && brew upgrade
Cocoapods: $ pod repo update

CocoaPods pod install. Modules cannot be imported

I installed CocoaPods by using $ sudo gem install cocoapods.
I have a swift Xcode project with the following podfile
platform :ios, '8.2'
use_frameworks!
target 'Clover' do
pod 'Alamofire', '~> 1.2'
pod 'SwiftyJSON', '~> 2.2'
pod 'ObjectMapper', '~> 0.12'
pod 'ImageLoader', '~> 0.3.0'
pod 'SVProgressHUD'
end
target 'CloverTests' do
end
After I run pod install, which seems to run correct with no error messages, I have a Pods folder generated with Pods.xcodeproject along with several other files.
However, when attempting to compile the project, I will into errors telling me my modules are not found. The error message is No such module followed by the module name.
I then attempted to install the modules manually and confirmed that the pods are indeed not working as each module after its manual installation, works.
I have searched and attempted several solutions as follows:
Deleted and reinstall pod.
Upgraded ruby to 2.2.1
Delete the pods folder and re-run $ pods install.
Clean the project.
More a comment than an answer, but I don't have enough reputation to comment:
When you use pod install with your-project.xcodeproject, it creates a new file/folder named your-project.xcodeworkspace (…project becomes …workspace) and this is this new file that you should open.
You didn't mention whether or not you knew that, so here you go: close the .xcodeproject in Xcode and open the .xcodeworkspace instead and it should work.

Resources