当试图安装谷歌分析和编译我的iOS 5的工程,我得到以下错误信息:问题编制的iOS 5应用程序时,与谷歌Analytics(分析)/ GANTracker
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GANTracker", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
,代码将无法编译。 我的构建目标是iOS 5中,我链接下面的库:
- libsqlite3.dylib
- libz.dylib
- libGoogleAnalytics.a
- CFNetwork的
- 和GANTracker.h
和投入:
#import "GANTracker.h"
#define kGANAccountId @"UA-XXXXXXX-X"
static const NSInteger kGANDispatchPeriodSec = 10;
@implementation AppDelegate
@synthesize window = _window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[GANTracker sharedTracker] startTrackerWithAccountID:kGANAccountId
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];
NSError *error;
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
name:@"iPhone1"
value:@"iv1"
withError:&error]) {
// Handle error here
}
if (![[GANTracker sharedTracker] trackEvent:@"my_category"
action:@"my_action"
label:@"my_label"
value:-1
withError:&error]) {
// Handle error here
}
if (![[GANTracker sharedTracker] trackPageview:@"/app_entry_point"
withError:&error]) {
// Handle error here
}
任何我已经按照一切:http://code.google.com/mobile/articles/analytics_end_to_end.html
我错过了一个库或框架吗? 我正在使用Xcode版本4.3.1
您是否添加了CFNetwork Framework? – malinois 2012-03-27 20:09:26
是的,编辑后。 – dvdfrddsgn 2012-03-27 20:11:56
正确答案张贴在这里:[http://stackoverflow.com/questions/9863336/error-message-when-linking-google-analytics-to-ios-app/10099445#10099445][1] [1]:http://stackoverflow.com/questions/9863336/error-message-when-linking-google-analytics-to-ios-app/10099445#10099445 – dvdfrddsgn 2012-04-16 20:43:49