iOS Admob Firebase SDKs with/without cocoapods - ios

I was trying to add cocoapods for admob firebase in my iOS app. But pod intsall command took too much time. Now i want to add firebase admob directly without cocoapods.
I have downloaded whole SDK from https://dl.google.com/firebase/sdk/ios/3_5_2/Firebase.zip .
It shows several folder with like AdMob Analytics, AppIndexing, Auth,Crash, Database,DynamicLinks, Invites, Messaging, RemoteConfig, Storage.
For cocoapods, we see they import firebase in .h file and add [Firebase configure] method.
What for SDK? Do I need to use only AdMob folder here? do I need to use the whole SDK? How would it need to be implemented?

Finally, i figured it out. import firebase is not working anymore. Hope the documentation is not updated properly.
Anyone should directly integrate Firebase to your project. And the documentation is not updated still. There is a issue there. Follow steps for analytics, add your database parameter from the video.
https://www.youtube.com/watch?v=joVi3thZOqc
https://www.youtube.com/watch?v=XIQsQ2injLo
Firebase and Admob for recommend to use cocoapods.
This contains 4 separate steps:
-Link with firebase
-Download GoogleService-Info.plist
– Update cocoapods
– init Firebase in app.
Link with Firebase:
This is just creating a connection Firebase with Admob app. From the console top right menu, there is a button to connection with firebase.
Console link : https://console.firebase.google.com/?pli=1
Download plist file :
It’s free and just takes a few minutes. When asked for a Bundle ID, enter the Bundle ID from the project you want to use for testing.
Once you have a GoogleService-Info.plist file, save it in the same directory as the rest of the XCODE project source.
Update cocoapods and install pod:
Now go to project directory from command terminal.
Run this command, this will install cocoapods
sudo gem install cocoapods
When cocoapods installation is complete, start adding to your projects with this command.
pod init
This command will create pod file in projects directory. You can add the rest command from terminal but also can be done by opening the file directly. I have done it for admob my project.
source ‘https://github.com/CocoaPods/Specs.git’
# platform :ios, ‘7.0’
pod 'Firebase', '>= 2.5.0'
target 'projectname' do
pod ‘Firebase/Core’
pod ‘Firebase/AdMob’
pod ‘Firebase/Database’
end
Save the file and go to command line again. Now run any of this two command.
pod install
OR
pod install –verbose
Second one worked for me. I got some bad file issue with first command. This may take more than 2 hours for the first time.
Got solution from this link : cocoapods - 'pod install' takes forever
When this complete, you will get some yellow line that firebase , admob and other necessary framework successfully added to your projects with cocopods.
Init FireBase (Most important step *** ) :
Google changes their framework but did not updated their documentation because the way is not working currently.
You may get some issues still:
Check you project settings -> Other Linker Option and set it $(inherited).
And Don’t forget to set Build architecture YES
Now you have to import Firbase and work for configuring it.
#import Firebase, this line is not working anymore.
So you have, import this like :
#import <Firebase/Firebase.h>
Now configure you Firebase in didFinishLaunchingWithOptions method using
[FIRApp configure];
This is for analytics. To init Database, follow this link:
Where to add Firebase Database Reference in iOS Obj-C
iOS : Objective-C : Firebase : Is it possible to read the cached data first for any reference?
CLEAN, BUILD AND RUN. Hope everything should works fine. You will see few line in your logs that Firebase has been started configuring projects. Happy Developing !!

Related

How do I remove Cocoapod pods from a Flutter project?

I have a Flutter app that runs fine on Android devices. It has a Firebase Firestore backend.
Now, I want to build it on an iOS simulator, and so I need to initialize the Firebase iOS app. (I had only initialized the Android version before.) So I tried following the steps on firebase.com for setting up the iOS Firebase app using Cocoapods... but I think I did something wrong! More specifically, I believe the steps I followed were for adding Firebase to a native iOS app (in Objective C or similar), but when using Flutter, I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually! (Here's a specific instruction for adding Firebase to a Flutter iOS project)
But before doing it right, I want to remove the pods that Cocoapods installed for me. Only I don't know how! 😣 When I web-search, I'm told to delete the pods I don't want from the Podfile. Only there ARE no pods in my ios/Podfile! There's only a bit that says:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
There's also an ios/Podfile.lock file, and THAT one has a list of all the pods... And then, there's an ios/Pods/Manifest.lock file, which also has such a list... So should I delete the unwanted pod names from one of these two files, instead?
Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?
Turns out the correct way to install and remove pods from a Flutter project is just to edit the pubspec.yaml file in the root directory!
Cocoapods needs to be installed, but it will automatically read the pubspec.yaml file and do the work from there! 🙂 No need to run pod commands from terminal or otherwise.
I suppose you followed these steps? in this case, you don't need to remove pods.
For step 1, step 2, it should be fine.
For step 3, just remove the config file.
For step 4, if you added firebase with swift package manager, remove it from your packages.
I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually!
How did you add pods manually? from your Podfile, I didn't see any new added pods.
Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?
You don't need to do anything, in worst cases, just remove the Podfile and re-run the app to let flutter regenerate it.

Parse SDK / CocoaPods

I have an objective C iOS app using the Parse SDK.
In the process of moving this app from Parse.com to a self hosted Parse-Server, I need to update the Parse SDK to the latest version. For this update I decided to go with CocoaPods.
This is the first time I touch CocoaPods (after reading and hearing so much good about it).
I found my way, following what I could read here and also based on a few CocoaPods tutorial I quickly viewed.
Having my project "ready", when buiding it I get this error:
#import <ParseUI/ParseUI.h> -----> File not found.
Obviously things have changed place. And I tried a couple of unsuccessful solutions.
So here is my question:
How do I need to change the settings of my project, now that I am using CocoaPods?
In order to use Cocoapods with parse and Parse UI you need to do the following steps:
Create a new file and name it Podfile. This file should be located on your IOS project root folder.
The Podfile should contain at least the following structure if you want to use parse IOS SDK and ParseUI
platform :ios, '8.0'
use_frameworks!
pod 'Parse'
pod 'ParseUI'
# Put more pods in here..
Notice to the platform, you may change it to the minimum version that your app can run on and the use_frameworks! will install all your pod as frameworks and this is mandatory if you like to consume Swift libraries.
Open terminal and navigate to your IOS root directory and enter pod install. This command will install all the pods and dependencies into your project.
After installing you will no longer use the IOS project file from now on you will use a new file which called workspace. The workspace will contain both your project files and the pods project/frameworks files.
Build your project, fix some error (if there are) and run it to make sure that it works as expected .
More CocoaPods commands that you need to know are:
pod update - update all your pods to the latest release or to the release that was mentioned in the Podfile
pod update update specific pod to the latest release or to the release that was mentioned in the Podfile
pod outdated - display out to date pods that are being used inside your project.

firebase quickstart ios sample

I am new to iOS and trying to run one of the quickstart sample of Firebase Database iOS samples provided on git hub.
The project contains swift folder and objective c folder. The objective c folder contains the storyboard and other info.plist files. But the swift folder contains only the .swift files, no storyboard or other files. How can I run the sample project for swift code.
The sample project also doesn't have an images.xcassets folder in it.
I am aware about the cocoa pods and Firebase setup for project.
Please try to run the sample provided by firebase on git and let me know how to solve the problem.
Swift and Objective-C are different targets of the same project for each of the samples - that means you switch between the two languages in XCode itself. To run them, you'll need XCode 8 and a recent install of Cocoapods. The steps are:
git clone https://github.com/firebase/quickstart-ios.git
cd database
pod update
open DatabaseExample.xcworkspace and select the DatabaseExampleSwift target in the drop down (to the right of the "Build And Run" and "Stop" buttons)
go to https://console.firebase.google.com and register a new app with the bundle ID com.google.firebase.quickstart.DatabaseExample
Take the GoogleService-Info.plist file that is downloaded, and drag it into XCode.
Select the GoogleService-Info.plist and look at the the File Inspector in the right hand panel of XCode. Make sure under "Target Membership" the DatabaseExampleSwift checkbox is ticket.
Hit the "Build And Run" button! You can run the sample on a simulator or on a real device if you have one provisioned.
Take a look here, they have own sample. You have to modify them for you.
https://www.raywenderlich.com/139322/firebase-tutorial-getting-started-2
https://www.appcoda.com/firebase/
Or
Better, don't go for it directly. I tried it for analytics. Better you directly integrate Firebase to your project. And the documentation is not updated still. There is a issue there. Follow my steps for analytics, add your database parameter from the video.
https://www.youtube.com/watch?v=joVi3thZOqc
https://www.youtube.com/watch?v=XIQsQ2injLo
Firebase and Admob for recommend to use cocoapods.
This contains 4 separate steps:
-Link with firebase
-Download GoogleService-Info.plist
– Update cocoapods
– init Firebase in app.
Link with Firebase:
This is just creating a connection Firebase with Admob app. From the console top right menu, there is a button to connection with firebase.
Console link : https://console.firebase.google.com/?pli=1
Download plist file :
It’s free and just takes a few minutes. When asked for a Bundle ID, enter the Bundle ID from the project you want to use for testing.
Once you have a GoogleService-Info.plist file, save it in the same directory as the rest of the XCODE project source.
Update cocoapods and install pod:
Now go to project directory from command terminal.
Run this command, this will install cocoapods
sudo gem install cocoapods
When cocoapods installation is complete, start adding to your projects with this command.
pod init
This command will create pod file in projects directory. You can add the rest command from terminal but also can be done by opening the file directly. I have done it for admob my project.
source ‘https://github.com/CocoaPods/Specs.git’
# platform :ios, ‘7.0’
pod 'Firebase', '>= 2.5.0'
target 'projectname' do
pod ‘Firebase/Core’
pod ‘Firebase/AdMob’
pod ‘Firebase/Database’
end
Save the file and go to command line again. Now run any of this two command.
pod install
OR
pod install –verbose
Second one worked for me. I got some bad file issue with first command. This may take more than 2 hours for the first time.
Got solution from this link : cocoapods - 'pod install' takes forever
When this complete, you will get some yellow line that firebase , admob and other necessary framework successfully added to your projects with cocopods.
Init FireBase (Most important step *** ) :
Google changes their framework but did not updated their documentation because the way is not working currently.
You may get some issues still:
Check you project settings -> Other Linker Option and set it $(inherited).
And Don’t forget to set Build architecture YES
Now you have to import Firbase and work for configuring it.
#import Firebase, this line is not working anymore.
So you have, import this like :
#import <Firebase/Firebase.h>
Now configure you Firebase in didFinishLaunchingWithOptions method using
[FIRApp configure];
This is for analytics. To init Database, follow this link:
Where to add Firebase Database Reference in iOS Obj-C
iOS : Objective-C : Firebase : Is it possible to read the cached data first for any reference?
CLEAN, BUILD AND RUN. Hope everything should works fine. You will see few line in your logs that Firebase has been started configuring projects. Happy Developing !!

Admob pods do not work after firebase integration

As you may be aware of it, Google now switch to Firebase instead of Google Analytics. So I tried to integrate it to my current working project. Admob is also integrated to my project with Pods.
I have followed Google's document and created a new pod and re-install with firebase. After it , now my project does not build.
Here is error
Use of unresolved identifiers "GADBannerView"
Try switching your imports to just:
#import GoogleMobileAds;
Everything should work as it was before, but using the module map is a great a way to pull in the headers rather than directly importing.
I have resolved it with:
-delete all pod related files from my project folder
-pod init
-re-add my required pods
-pod install
So I get this error as well with GADRequest errors even on Google's sample Banner project.
I fixed it with #Ian Barber's suggestion with #batgun's answer, of updating cocoapod version to 1.0.0 by running
$ [sudo] gem install cocoapods
https://guides.cocoapods.org/using/getting-started.html
then deleting all cocoapod items then install them again.
When I was in cocoapod version lower than 1.0.0, when I run pod install again, I still had errors, like "Use of unresolved identifier 'GADRequest'"
I retyped the whole thing and worked perfectly. When I was still not in cocoapod 1.0.0 version (i think it was 0.39 version), I can only find GADRequestError and not GADRequest.
When I retry extracting the original project now, do pod install and run the app, It doesn't throw any errors now.
I believe this has something to do with cocoapod version but it is not in google admob instruction to update it on.
I was trying to figure this out since the day of the release and losing hope for firebase because it was the sample basic banner project and it doesn't work!
VERIFIED!
I can verify it has something to do with cocoapod version.
I was trying to do the Google's Codelab 'FriendlyChatSwift' practice project since the release and throws a bunch of errors after running pod, not finding bunch of classes.
Steps:
$ [sudo] gem install cocoapods
I deleted the existing downloaded pods and related (ProjectName.xcworkspace, PodFile.lock, /Pods)
Run pod install
Build and Run of the project
It worked perfectly. I also tried running the project before doing this steps and It had bunch of errors.
I had this same issue and this helped me get setup the way I needed it but I don't think anyone touched on my exact issue. Thought I'd provide that just in case someone was looking.
After I cleared everything out and ran pod init I noticed that the generated pod file has use_frameworks! set in it. Once I added that everything was solved. Stupid mistake on my part since you need use_frameworks! for swift projects but leaving that out lead to a lot of random not found errors showing up and going away at random. Hope this helps someone.

Include GCM sdk to cocoapod project

I already have a podsfile importing several other projects as frameworks, which works pretty nicely. Unfortunately it is not possible to install the gcm ios library as a framework. What is the way to go here? Just drag and drog the gcm pod into the project?
There's a setup guide for both objective-c and swift on the developers site of gcm, it can be found here - https://developers.google.com/cloud-messaging/ios/client?ver=swift
pod init
Open the Podfile created for your application and add the following:
pod 'Google/CloudMessaging'
Save the file and run:
pod install
This creates an .xcworkspace file for your application. Use this file for all future development on your application.

Resources