我添加了GAI 框架。
文件:
- GAI.h
- GAIDictionaryBuilder.h
- GAIFields.h GAILogger.h
- GAITrackedViewController.h
- GAITracker.h
- libGoogleAnalytics_debug.a
但是当我尝试构建项目时,它显示了这样的错误:
Undefined symbols for architecture i386:
"_llvm_gcda_emit_arcs", referenced from:
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAI.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIUncaughtExceptionHandler.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIBatchingDispatcher.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIStringUtil.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
...
"_llvm_gcda_emit_function", referenced from:
___llvm_gcov_writeout in ...
"_llvm_gcda_end_file", referenced from:
___llvm_gcov_writeout in ...
"_llvm_gcda_increment_indirect_counter", referenced from:
-[GAI defaultTracker] in libGoogleAnalytics_debug.a(GAI.o)
-[GAI setDefaultTracker:] in libGoogleAnalytics_debug.a(GAI.o)
...
"_llvm_gcda_start_file", referenced from:
___llvm_gcov_writeout in ...
ld:未找到体系结构 i386 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
是什么导致了这个错误?
更新 :
// AppDelegate.h
@property (nonatomic, retain) id<GAITracker> tracker;
// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[GAI sharedInstance].optOut = YES;
[GAI sharedInstance].dispatchInterval = 120;
[GAI sharedInstance].trackUncaughtExceptions = YES;
self.tracker = [[GAI sharedInstance] trackerWithName: kTrackerName
trackingId: kTrackingId];
//other code
return YES;
}