简体   繁体   English

iOs:Swift Google Analytics

[英]iOs: Swift Google Analytics

I am new to iOs development and would like to implement Google Analytics (swift). 我是iOs开发的新手,想要实施Google Analytics(快速)。

It appears there is some missing information on implementing Google Analytics in swift on Google's instruction page : 似乎有一些关于在 Google的说明页面 上快速实施Google Analytics的信息

在此输入图像描述

It seems the import statement above is incorrect, can anyone assist me with the missing/correct statement? 上面的导入声明似乎不正确,任何人都可以帮助我找到丢失/正确的声明吗?

Exta Info: Exta信息:

  • I come from a Java background and IDEs I use import for you, so please excuse my stupidity. 我来自Java背景和我使用import的IDE,所以请原谅我的愚蠢。
  • I have cocopods installed, and use other pods: Almofire, Fabric, swiftyJson etc 我安装了cocopods,并使用其他pod:Almofire,Fabric,swiftyJson等
  • I am developing for iOs 8 我正在为iOs 8开发
  • Instructions above this, are clear and working. 上面的说明清楚可行。 Installing the pods/config file etc 安装pods / config文件等

In your Objective-C bridging header file, You should import GA header files: 在Objective-C桥接头文件中,您应该导入GA头文件:

#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"

I am not sure if I am missing some import. 我不确定我是否错过了一些导入。

If you look in your Pods folder in Xcode you can see the available pods there. 如果你在Xcode中查看你的Pods文件夹,你可以在那里看到可用的pod。 Most of them usually have a file that contains all import statements for any files needed. 它们中的大多数通常都有一个文件,其中包含所有所需文件的所有import语句。 In this case its the Analytics.h file in Pods/Google/Analytics/ 在这种情况下,它是Pods/Google/Analytics/的Analytics.h文件

I'm guessing that, to import this file in your bridging header (which I hope you have, if not let me know), you can use #import "Google/Analytics.h" . 我猜测,要在你的桥接标题中导入这个文件(我希望你有,如果不让我知道),你可以使用#import "Google/Analytics.h"

It also says a little bit lower on the page, to import the <Google/Analytics.h> to the header. 它还会在页面上略低一点,将<Google/Analytics.h>导入标题。

图片显示谷歌页面上的文本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM