带有/不带cocoapods的iOS Admob Firebase SDK [英] iOS Admob Firebase SDKs with/without cocoapods

查看:373
本文介绍了带有/不带cocoapods的iOS Admob Firebase SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在iOS应用程序中为admob firebase添加cocoapods。但是pod intsall命令花费了太多时间。现在我想直接添加firebase admob,而不用cocoapods。 我已经从 https://dl.google.com/firebase/sdk/ios/3_5_2/Firebase.zip
它显示了AdMob Analytics,AppIndexing,Auth,Crash,Database,DynamicLinks,Invites,Messaging,RemoteConfig,Storage等文件夹。


对于cocoapods,我们看到他们在.h文件中导入firebase并添加了[Firebase configure]方法。

什么适用于SDK?我需要在这里只使用AdMob文件夹吗?我需要使用整个SDK吗?如何实现?

解决方案

最后,我想通了。导入firebase不再工作了。希望文档没有正确更新。

任何人都应该直接将Firebase集成到您的项目中。而且文档还没有更新。那里有一个问题。按照分析的步骤,从视频添加您的数据库参数。



https://www.youtube .com / watch?v = joVi3thZOqc



https://www.youtube.com/watch?v=XIQsQ2injLo



建议使用cocoapods的Firebase和Admob。

这包含4个单独的步骤:

-link with firebase



- 下载GoogleService-Info.plist



- 更新cocoapods / p>

与Firebase链接:
这只是通过Admob应用创建与Firebase的连接。从控制台右上角的菜单中,有一个按钮可以连接到firebase。



控制台链接: https://console.firebase.google.com/?pli=1



下载plist文件:
这是免费的,只需要几分钟。当被要求输入一个Bundle ID时,输入你想用来测试的项目的Bundle ID。



一旦你有一个GoogleService-Info.plist文件,与其他XCODE项目源相同的目录。
$ b $ p更新cocoapods并安装pod:
现在从命令终端进入项目目录。



运行此命令,这将安装cocoapods

  sudo gem install cocoapods 

当cocoapods安装完成后,使用这个命令开始添加到您的项目。

  pod init 

项目目录中的pod文件。您可以从终端添加休息命令,但也可以通过直接打开文件来完成。我已经做了admob我的项目。

  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

保存文件并再次转到命令行。现在运行这两个命令中的任何一个。

  pod install 

OR

  pod install -verbose 

第二个为我工作。我用第一个命令得到了一些不好的文件问题。这可能需要第一次超过2个小时。
从这个链接中获得解决方案: cocoapods - 'pod install'永远占用


完成后,您将获得一些黄线,firebase,admob和其他必要的框架已成功添加到您的项目与cocopods。


  1. Init FireBase(最重要的步骤***):

Google改变了他们的框架,但没有更新他们的文档,因为这种方式目前还不行。

您可能还会遇到一些问题:
检查您的项目设置 - >其他链接器选项并将其设置为$(继承)。
并且不要忘记设置生成架构是



现在您必须导入Firbase并且配置它。

  @import Firebase,此行不再有效。 

所以你有这样的导入:

  #import< Firebase / Firebase.h> 

现在使用

配置Firebase在didFinishLaunchingWithOptions方法中, [FIRApp configure];

这是用于分析的。要初始化数据库,请点击此链接:


  1. iOS:Objective-C:Firebase:是不是?可能首先读取缓存的数据以供参考?

CLEAN,BUILD和RUN。希望一切都应该正常工作。您会在日志中看到几行消息,Firebase已经开始配置项目。快乐发展!

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.

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

  1. Where to add Firebase Database Reference in iOS Obj-C
  2. 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 !!

这篇关于带有/不带cocoapods的iOS Admob Firebase SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆