Firebase SDK pod installation linker error - swift

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...

Related

Trying to install GeoFire through Cocoapods, but getting Objective-C Module error

So there is an odd build issue I’m encountering.
I have an existing Xcode project where all my packages have been added through Xcode itself (I think Xcode basically uses Swift Package Manager underneath).
I came to a point where I needed to now use GeoFire . But Geofire needs to be installed through Cocoapods. But my Xcode project never used cocoapods.
So to integrate Cocoapods I did the following:
brew install cocoapods
opened terminal and navigated to root directory of iOS app (where <app-name>.xcodeproj exists)
pod init
opened the generated Podfile and added the following:
…
platform :ios, '11.0’
…
pod 'GeoFire', '~> 4.0’
…
pod install
opened <app-name>.xcworkspace
Then when I went to build the project, the following failure occurred (see image attached to question)
None of the workarounds suggested have helped me thus far. Any thoughts?
NOTE: I am doing all this on an M1 Macbook.
Wow, strange issue.
What ended up fixing it for me was to go to my pod file and replace:
pod 'GeoFire', '~> 4.0'
With:
pod 'GeoFire/Utils'
Now I can use GeoFire in my file as I wish.

When I compile the application I get an error equal to this: Could not build Objective-C module 'Firebase'

None of my 'Firebase' pods are found.
I updated to Xcode 9.
Ran 'pod update'
deitegrated my pods, and re-installed
Deleted 'Derived Data' folder contents
Build from 'Generic Devices'
Added the paths in the Header Search Path in the Build Settings $(inherited)
and
"$(SRCROOT)/Pods"
and
"${PODS_ROOT}/Firebase/Core/Sources"
Cleaned, build, closed the app, re-installed Xcode, restarted the system, and did it all again.
2 Swift Compiler Errors are always there.
'FirebaseAnalytics/FirebaseAnalytics.h' file not found
and
Could not build Objective-C module 'Firebase'
I'm on Sierra 10.12.6
None of these has worked so far to get rid of them. Does anyone know of any other possible solutions?
Here is the pod file info.
Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MP' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MP
pod 'Firebase'
pod 'Firebase/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
end
------ UPDATE ------
as Hexfire suggested below. I removed pods and manually added the frameworks.
After some fiddling with the pathing for my MP.h file, that first error is gone, however now I am getting these compiler errors now...
:0: error: PCH file '/Users/.../Library/Developer/Xcode/DerivedData/MP-gwnwsbrisiyspxepcxkbrojwtfrs/Build/Intermediates.noindex/PrecompiledHeaders/MP-swift_ZJX6RAPYV1IT-clang_2SW1CJQDTFSBO.pch' not found: module file not found
clang importer creation failed
I built a .pch file 'MP.pch' and I pointed to it in the Build Settings Prefix Header with $(SRCROOT) with no luck. Do I have to put all of my Framework paths in there as well?
All of this seems related to the search paths. Does anyone have any other thoughts here? Perhaps an example of the build settings syntax? For example $(SRCROOT) with quotes or without? $(SRCROOT)/MP.pch or just $(SRCROOT)?
One of the good ways to make this work is by not using CocoaPods. You can grab all necessary Firebase libraries from here and use within your app (if link doesn't work, go here, and scroll down to "Integrate without CocoaPods").
After downloading:
Unzip and see the README file for which Frameworks to include in to your project.
Add the ObjC linker flag in your Other Linker Settings in your target's build settings.
This is a valid option and 100% workable.
P.S. If Firebase is the only pod you are using, you can quickly and safely clean your project from any CocoaPods trails by using pod deintegrate command.
Good luck!
If All Of this do not work Try this for once
run sudo gem install cocoapods
You can check your version by typing pod --version anywhere on your terminal.
Make sure you are using latest Version of it

cocoapods Google Mobile ads does not generate .xcworkspace file

I am exporting a project from Unity3d to xcode that uses the last GoogleMobileAds package.
I have installed and updated cocoapods and also have the famous podfile containing de following lines:
source 'https://github.com/CocoaPods/Specs.git'
install! 'cocoapods', :integrate_targets => false
platform :ios, ‘8.0’
target ‘MyProject’ do
pod 'Google-Mobile-Ads-SDK', '~> 7.14’
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
and I run
pod install
and
pod update
successfully
dependancies are downloaded alright, as you can see the results below:
Updating local specs repositories
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Analyzing dependencies
Downloading dependencies
Using Firebase (3.9.0)
Using FirebaseAnalytics (3.5.1)
Using FirebaseCore (3.4.4)
Using FirebaseInstanceID (1.0.8)
Installing Google-Mobile-Ads-SDK (7.14.0)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleToolboxForMac (2.1.0)
Generating Pods project
Skipping User Project Integration
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 8 total pods installed.
According to both cocoapods and google mobile ads documentation, I will need to continue with "MyProject.xcworkspace" but the file is nowhere to be found.
any suggestions?
When using install! 'cocoapods', :integrate_targets => false Cocoapods will not create an xcworkspace for you.
That's the intended behaviour. You'll even notice this if you follow the command prompt. This line is telling you that no integration is taking place.
Skipping User Project Integration
If you want to get an xcworkspace just remove :integrate_targets => false
It seems the problem comes from editing the Podfile using TextEdit.
As it warns you that you should not continue using TextEdit, one could falsely suppose that the program is intelligent enough to understand and correct these unwanted modifications.
This is the solution I have found:
delete the Podfile and Podfile.lock from your working directory
create a new Podfile using pod init
install SublimeText and use it to open the Podfile
add the necessary pods for the project
(I also included the line "use_frameworks!" although it may not be
needed.)
run "pod install" and "pod update"; this time I get
[!] Please close any current Xcode sessions and use Orbit.xcworkspace for this project from now on.
and the file is now available in project directory
You was used this guide for install pod?
In addition to Radu Dita's message. If you do not want that line to be added (so you do not need to delete it later), you need to disable cocoapods integration in "iOS Resolver Settings" by selecting "None", build project and then enable it back "Xcode Workspace". I found this with try and error. I hope my message will save save someone's time

Unable to build ScanApiSdk with error ScanApiHelper.h file not found

I am attempting to add in the Socket Mobile ScanApiSdk into my project but it is failing to build with the error 'ScanApiHelper.h' file not found. I have installed it into my project workspace using the CocoaPods method. Unzipped the SDK into a folder at the same folder level as my project folder. Adding the following line to my Podfile.
pod 'ScanAPI', :path => '../scanapisdk'
Then ran the pod install command at prompt. Launched project from the xcworkspace file and then added the following line to my bridging header.
#import "ScanApiHelper.h"
Build fails at this line in the bridging header.
Xcode Version 8.0 (8A218a)
gem --version 2.0.14.1
pod --version 1.0.1
ScanAPI SDK Version 10.3.55
I was able to download the sample SingleEntrySwift project from Github, build it, and load it on my iPhone for testing.
Can someone help point out what I am doing wrong in my own project or troubleshooting steps?
I had this issue too and this solution worked for me.
Basically, you don't need a bridging header if you use use_frameworks!. Instead you just import ScanAPI in any swift files that use ScanAPI.

Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

Yesterday I updated Xcode to Version 7.3 (7D175) and suddenly my apps is not building any more. My dead line is near and I can't build the apps :-(
I tried to change Build Settings to:
allow non-modular includes in framework modules = yes
enable modules = no
My pod file:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
use_frameworks!
#Parse, Facebook, Twitter
pod 'Parse'
pod 'ParseUI'
pod 'ParseFacebookUtilsV4'
pod 'ParseTwitterUtils'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
installed cocoapods-0.39.0
Analyzing dependencies
Downloading dependencies
Using Bolts (1.6.0)
Using FBSDKCoreKit (4.10.1)
Using FBSDKLoginKit (4.10.1)
Using FBSDKShareKit (4.10.1)
Using Parse (1.13.0)
Using ParseFacebookUtilsV4 (1.11.1)
Using ParseTwitterUtils (1.10.0)
Using ParseUI (1.2.0)
What should I do to solve this issue?
I changed back app build settings to:
allow non-modular includes in framework modules = no
enable modules = yes
And I changed the Pods > ParseFacebookUtilsV4 as follow in the image below and everything is fine again. I hope that can help you too.
See the screen-shot
It worked for me!