我一直在尝试通过遵循在线文本教程将谷歌分析添加到我正在开发的应用程序中,起初还可以,但最后我在此代码上遇到错误...(特别是 .m 文件中的代码)
两件事情:
当我进行谷歌分析时,我没有注册任何信息,当我尝试编译和运行时,下面的代码行会注册一个错误
另一件事是在所有这些代码中是否有一个部分我应该从谷歌分析中放置跟踪器 ID?
PS是否可以包含我正在关注的教程的链接,以便你们知道我在说什么?我不想被禁止所以想我会先问...
- (IBAction)tappedButtonOne:(id)sender {
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker sendEventWithCategory:@"MyFirstScreen"
withAction:@"ButtonPress"
withLabel:@"ButtonOne"
withValue:nil];
}
这是我在 .h 中的代码
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
#import "GAITrackedViewController.h"
@interface ViewController : GAITrackedViewController <ADBannerViewDelegate>
@property (retain, nonatomic) IBOutlet ADBannerView *banner;
@property (retain, nonatomic) IBOutlet UITextView *txtinfo;
- (IBAction)tappedButtonOne:(id)sender;
@end
这是我在 .m 中的代码
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc {
[_banner release];
[_txtinfo release];
[super dealloc];
}
- (IBAction)tappedButtonOne:(id)sender {
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker sendEventWithCategory:@"MyFirstScreen"
withAction:@"ButtonPress"
withLabel:@"ButtonOne"
withValue:nil];
}
@end