How to fix the error "No such module "FirebaseAuth" - swift

I installed all the pods that I needed, but Xcode shows me an error "No such Module FirebaseAuth", I tried this I found:
Shift+ Command + K to clean the workspace
I reinstalled the podfile in the Terminal
Command + b
I am already in the workspace, not in the project file
I didn't know if that helps but I reinstalled the computer.
import UIKit
import FirebaseAuth
import FirebaseDatabase
import FirebaseStorage
Here is the Pod file:
target 'Ouvrigram' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
# Pods for Ouvrigram
end
I installed all the pods, I checked there are installed, I don't​ know what I am to do Pls help.

Are you sure the target name is the same as your Xcode project name ?
Also make sure you are opening the project with the .xworkspace file. You can't use the .xcodeproj file anymore if you are using pods

XCode is really buggy and Apple isn't really excited about improving their compatibility with Google services. I get the same error even after importing:
import Firebase
import FirebaseFirestore
import FirebaseAuth
import FirebaseFirestoreSwift
But my project builds and runs successfully in spite of all the RED errors everywhere on my project.
In fact, a simple "import Firebase" is enough for a successful build.
XCode Version 13.4.1 (13F100)

Try to replace content of your Podfile with Podfile-ios-objc
https://github.com/flutter/flutter/blob/master/packages/flutter_tools/templates/cocoapods/Podfile-ios-objc
It works for me.

Related

No such module GooglePlaces

I am trying to install the GooglePlaces pod so that I can use the autocomplete feature, however, after successfully installing it, xcode keeps telling me that no module is found.
It seems to be a problem with the GooglePlaces pod, as the others aren't throwing this error. However, we can see that in my pods folder, it is installed.
Here is my Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
target 'TestApp5' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for TestApp5
pod 'FirebaseAuth'
pod 'GooglePlaces', '7.3.0'
end
I have tried uninstalling Cocoapods, changing the GooglePlaces version, changing the platform version, and making a whole new Xcode project to test this.

No such module 'FacebookCore' in swift 5

I am doing my own test app as part of my learning process in iOS development (using swift 5 on Xcode 11.0). I want to add login with Facebook on my login page but I keep getting No such module 'FacebookCore' when importing the library.
I followed the instructions on developer.facebook and tried to implement the SDK using cocoaPods and here is my Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'TestApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for TestApp
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
target 'TestAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'TestAppUITests' do
# Pods for testing
end
end
After executing pod install and adding the data in my info.plist as instructed by Facebook, I can clearly see that the framework has been linked in the Link Binary With Libraries section
But still, I can't seem to import FacebookCore nor FacebookLogin.
PS: I tried several solutions like:
1- Running the .xcworkspace instead of .xcodeproj
2- Building the project even with the error being displayed (some said it would go away)
But none of them worked.
I suspect that the problem is in my Framework search path but why would it be wrong in the first place? so I may be wrong, here's a screenshot to my search path anyway:
So it turned out that I have to import FBSDKCoreKit instead of FacebookCore which was not mentioned in facebook's documentation. And it should be imported strictly using the .xcworkspace file which was also not mentioned in the documentation.
Use FBSDKCoreKit instead of FacebookCore
This are the correct pods
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
and your imports should be
import FBSDKCoreKit
import FBSDKLoginKit
in previous version there was FacebookCoore as wrapper for the FBSDKCoreKit classes. It looks like Facebook has removed this since v5.x.
The following should be your entries in Podfile
pod 'FacebookCore'
pod 'FacebookLogin'
and your imports should be
import FacebookCore
import FacebookLogin

FIRAuth files not compatible with FirebaseUI: use of undeclared identifier 'FIRAuthErrorUserInfoUpdatedCredentialKey'

I just recently updated my podfile and added two entries pod 'Firebase/Storage' and pod 'FirebaseUI/Storage'. When I added these two entries, when I open up my project in Xcode, the build fails, and I get the following error:
Use of undeclared identifier 'FIRAuthErrorUserInfoUpdatedCredentialKey'; did you mean 'FIRAuthUpdatedCredentialKey'?
Replace 'FIRAuthErrorUserInfoUpdatedCredentialKey' with 'FIRAuthUpdatedCredentialKey'
This error is found in FUIAuth.m. Looking at the GitHub project for FirebaseAuth, I see the the FIRAuthErrorUserInfoUpdatedCredentialKey is supposed to be defined in the FIRAuthErrors.h file (https://github.com/firebase/firebase-ios-sdk/blob/master/Firebase/Auth/Source/Public/FIRAuthErrors.h), but the file that I have currently is not the same as the one in the GitHub project. I'm not exactly sure how I should be setting up my podfile to correctly make these pods work together.
Here's the contents of my podfile:
# 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 ChurchSearch
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/Facebook'
pod 'FirebaseUI/Twitter'
pod ‘Geofirestore'
target 'AppNameTests' do
inherit! :search_paths
# Pods for testing
end
end
Then here's what I was getting on the terminal:
Analyzing dependencies
Downloading dependencies
Using Bolts (1.9.0)
Using BoringSSL-GRPC (0.0.3)
Using FBSDKCoreKit (4.44.1)
Using FBSDKLoginKit (4.44.1)
Using Firebase (5.4.1)
Using FirebaseAnalytics (5.0.1)
Using FirebaseAuth (5.0.2)
Using FirebaseCore (5.0.6)
Using FirebaseDatabase (5.0.2)
Using FirebaseFirestore (0.12.6)
Using FirebaseInstanceID (3.1.1)
Using FirebaseStorage (3.0.0)
Using FirebaseUI (6.2.1)
Using GTMSessionFetcher (1.2.1)
Using GeoFire (3.0.0)
Using Geofirestore (0.1.0)
Using GoogleSignIn (4.4.0)
Using GoogleToolboxForMac (2.2.0)
Using GoogleUtilities (5.8.0)
Using Protobuf (3.7.0)
Using TwitterCore (3.2.0)
Using TwitterKit (3.4.2)
Using gRPC (1.20.0)
Using gRPC-Core (1.20.0)
Using gRPC-ProtoRPC (1.20.0)
Using gRPC-RxLibrary (1.20.0)
Using leveldb-library (1.20)
Using nanopb (0.3.901)
Generating Pods project
Integrating client project
Sending stats
I also tried cleaning and removing the pods and reinstalling, but that didn't change anything. I did run a pod repo update as well at one point, I don't know if that would cause issues. Does anyone know what I'm doing wrong, or how I can make these work properly?
I finally got this working. I think my actual issue was that, after a pod repo update, FirebaseUI got updated to 6.2.1, from 5.2.2. For some reason, cocoapods thinks that FirebaseUI 6.2.1 is compatible with FirebaseAuth 5.2.0. These are NOT compatible. You'll get the above error if you try to use those two libraries together. So I deleted my podfile.lock, and ran pod deintegrate one more time to clear everything. Then I added pod FirebaseUI, '5.2.2' to my podfile, ran pod install, and it worked!
I additionally updated my cocoapods from 1.5.3 to 1.6.1, which may also have helped.

No such module JSQMessagesViewController

I'm trying to import JSQMessagesViewController:
import JSQMessagesViewController
And it gives me the error 'no such module'. I've seen many people with this problem on the web but I can't find the solution. Here's my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, ‘9.2’
# Uncomment this line if you're using Swift
use_frameworks!
target ‘IXODES’ do
pod 'JSQMessagesViewController'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
end
I've tried cleaning the build, also pod deintegrate and then pod install and pod update. Nothing works and I can see the library in my project like the rest. Any help?
perhaps you tried to import the file and the file is missing by any chance,
a few things you can do.
you can clean the project from cocoapods and re-install cocoapod(this helped me onetime i got the same problem the file were missing) you can do that by
run this code on the terminal
[sudo] gem install cocoapods-deintegrate
once done
cd your file
and then run thispod deintegrate
then you're all set! and re install it
---- another solution ---
try these
1-Adding all of the .frameworks to the Projects Build Phases -> Link Binary With Libraries
2-Selecting each framework and building it. You can do this by selecting your project name next to the run arrow.
3-Cleaning the project and restarting my computer.
hope it helps

Firebase SDK pod installation linker error

I wanted to implement Firebase SDK in my Swift project. I followed the instructions and installed pods, created a Podfile as follows:
platform :ios, '7.0'
target 'MyApp' do
pod 'Firebase'
project '/Users/MyName/Desktop/MyApp/MyApp.xcodeproj'
end
Then as I do install pods, it comes out with the following in terminal:
Analyzing dependencies
Downloading dependencies
Using Firebase (3.9.0)
Using FirebaseAnalytics (3.5.1)
Using FirebaseCore (3.4.4)
Using FirebaseInstanceID (1.0.8)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleToolboxForMac (2.1.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 7 total pods installed.
So I thought it worked but after reading various posts online apparently this is supposed to produce a xcworkspace file which I'm supposde to use instead of xcodeproj- is that correct? And if so why hasn't it generated it? I don't understand what is going wrong.
It might also be relevant info that I added all the bits to my xcodeproj file (before realising I should be working with xcworkspace instead) so the pods had come up in my xcodeproj, I added the import Firebase header file, the Google service info, plist and the import+ FIRApp.configure() in delegate and added $(inherited) in other linkers and when I try to use simulator it comes up with an error saying:
Library not found for GoogleToolBoxForMac
Linker command code failed with exit code 1 (use -v to see invocation).
How come it allowed me to do all this if the initial install was incorrect? And where do I go from here?
Can I please get some help about what is going wrong? And how can I solve this problem? Or at least am I able to go back to step one and reverse all these changes smoothly?
If possible please use examples, I am a newbie.
Incase someone else is having this error. The problem was that I was in the wrong directory and had attempted to put a Podfile with the directory leading to 'MyApp.xcodeproj'. This is incorrect as the Podfile should just be in the folder. Initially I was not able to locate this folder (even though it was on my Desktop) so I used in terminal:
cd ~/Desktop
then
cd ~/Desktop/MyApp
and then
pod init
and edited the Podfile followed by
pod install...