Chr*_*son 6 google-analytics cocoapods swift3 xcode8
在我的桥接标题中,我无限地得到"<Google/Analytics.h> not found"
我按照谷歌自己的教程:https://developers.google.com/analytics/devguides/collection/ios/v3/?ver = swift
我尝试过人们发布的'pod GoogleAnalytics'方法.
我已经尝试了人们在其他主题中发布的所有建议.
我还需要在"构建设置"中更改其他内容吗?或者"pod install"是否可以执行所有操作?
kar*_*ran 16
最后我解决了Swift 4.0和xcode 9.0.1.
对我来说,2天后我解决了..不要按照Google的旧文档说 #import <Google/Analytics.h>
pod initpod 'GoogleAnalytics'在你的pod文件中target 'GoogleAnalytics' dopod install你会发现框架GAI.h和其他文件将在pods文件夹下Header.h根目录的文件.不要#import <Google/Analytics.h>在桥接头文件中单独添加以下导入例如在桥接头文件中删除 #import <Google/Analytics.h>
#import "GAI.h"
#import "GAITracker.h"
#import "GAIFields.h"
#import "GAIDictionaryBuilder.h"
Run Code Online (Sandbox Code Playgroud)
将您的网桥指向目标Swift编译器的Build Settings下 - General - > Objective-C Bridging Header.写下Header.h您的桥接文件名
从google for swift添加代码didFinishLaunchingWithOptions 不要忘记从Google Analytics页面替换您的跟踪ID
guard let gai = GAI.sharedInstance() else {
assert(false, "Google Analytics not configured correctly")
}
gai.tracker(withTrackingId: "YOUR_TRACKING_ID")
// Optional: automatically report uncaught exceptions.
gai.trackUncaughtExceptions = true
// Optional: set Logger to VERBOSE for debug information.
// Remove before app release.
gai.logger.logLevel = .verbose;
Run Code Online (Sandbox Code Playgroud)田田....运行你的项目......
| 归档时间: |
|
| 查看次数: |
2913 次 |
| 最近记录: |