我想在我的应用程序中获取GA。我试着这样做:在Xcode5 SDK 3.03中编译时添加Google Analytics(分析)链接器错误
我用这个谷歌Analytics(分析)SDK适用于iOS 3.0版(测试版) - https://developers.google.com/analytics/devguides/collection/ios/v3/
我已经按照文档的所有步骤。 也已经尝试过Linker errors when trying to install new Google Analytics 3.0 Beta
在我AppDelegate.h
#import <UIKit/UIKit.h>
#import "GAI.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property(nonatomic, strong) id<GAITracker> tracker;
@property (strong, nonatomic) UIWindow *window;
@end
在我AppDelegate.m
#import "AppDelegate.h"
#import "GAI.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[GAI sharedInstance].trackUncaughtExceptions = YES;
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 20;
// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
// Initialize tracker.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-47246605-1"];
[GAI sharedInstance].optOut = YES;
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 0;
return YES;
}
ViewController.h
#import <UIKit/UIKit.h>
#import "GAI.h"
#import "GAITrackedViewController.h"
@interface ViewController : GAITrackedViewController
@end
ViewController.m
#import "ViewController.h"
#import "GAI.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.screenName = @"Home Screen";
}
链接,我的项目的测试:https://www.dropbox.com/s/j3ufrv55xym82nc/TesteAnalytics.zip
如何确定您错过了哪个框架:1)查看“未定义符号”部分中的名称; 2)谷歌他们(没有_OBJC_CLASS _ $ _部分); 3)点击该类的Apple文档链接并阅读框架名称。 – Kreiri