iphone - Google Analytics 集成 iOS 时出错
<p><p>我需要将谷歌分析添加到我的 iOS 应用中,</p>
<p>我已经实现了这 3 个步骤。</p>
<p><strong>第 1 步:</strong>下载谷歌分析库文件并将此文件添加到项目中,</p>
<ul>
<li>GAI.h</li>
<li>GAITracker.h</li>
<li>GAITrackedViewController.h
-GAIDictionaryBuilder.h</li>
<li>GAIFields.h</li>
<li>GAILogger.h</li>
<li><p>libGoogleAnalyticsServices.a</p></li>
<li><p>CoreData.framework</p></li>
<li>SystemConfiguration.framework</li>
<li>libz.dylib</li>
</ul>
<p><strong>第 2 步:</strong>在 <code>didFinishLaunchingWithOptions</code></p> 中添加此代码
<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
.trackUncaughtExceptions = YES;
.dispatchInterval = 20;
[[ logger] setLogLevel:kGAILogLevelVerbose];
[ trackerWithTrackingId:@"UA-XXXX-Y"];
}
</code></pre>
<p><strong>第 3 步:</strong>例如,假设您有一个“主屏幕” View ,要使用如下所示的 ViewController 标题进行测量:</p>
<pre><code>@interface HomeViewController : UIViewController
</code></pre>
<p>我已将此标题更新为:</p>
<pre><code>#import "GAITrackedViewController.h"
@interface HomeViewController : GAITrackedViewController
</code></pre>
<p>这样做后,我得到了类似的错误,</p>
<pre><code>duplicate symbol _OBJC_CLASS_$_GAIUtil in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIUtil.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIUtil.o)
duplicate symbol _OBJC_METACLASS_$_GAIUtil in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIUtil.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIUtil.o)
duplicate symbol _OBJC_CLASS_$_GAIDefaultLogger in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIDefaultLogger.o)
duplicate symbol _OBJC_IVAR_$_GAIDefaultLogger._logLevel in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIDefaultLogger.o)
duplicate symbol _OBJC_METACLASS_$_GAIDefaultLogger in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIDefaultLogger.o)
</code></pre>
<p><strong>编辑:</strong>
我已经在我上面告诉你的项目中添加了这个框架和库。
<img src="https://i.imgur.com/SiDsNs7.png" alt=""/> :
<strong>我在哪里做错了?请帮忙</strong></p>
<p><strong><em>提前致谢。</em></strong></p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您必须从您的项目中删除这两个 <code>libGoogleAnalytics_debug.a, libGoogleAnalyticsServices.a</code> 之一。找出它们在哪里以及它们是如何生成和制作的,您的构建中只涉及这些库中的一个。我想,其中一个是您添加的,另一个是在您构建时自动创建和添加的。 </p></p>
<p style="font-size: 20px;">关于iphone - Google Analytics 集成 iOS 时出错,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/18585583/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/18585583/
</a>
</p>
页:
[1]