After a lot of try, i put a small sample of how to get data, if this can help someone:
NSString *const kKeychainItemName = @"eKit: gan";
NSString *const kMyClientID = @"149329999999-heob9dk0o7d9999nkufaehrk99iaf9na.apps.googleusercontent.com"; // pre-assigned by service
NSString *const kClientSecret = @"pAzA-4AAAAAcAAAmAAAAAjbA"; // pre-assigned by service
@interface sFirstViewController ()
@end
@implementation sFirstViewController {
APPaginalTableView *_paginalTableView;
GTLObject *myGTL;
}
- (void)viewDidLoad{
[super viewDidLoad];
}
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
if (error != nil) {
// Authentication failed
} else {
// Authentication succeeded
self.auth=auth;
[self analytics_Query];
[viewController dismissViewControllerAnimated:TRUE completion:nil];
}
}
- (void)analytics_Query{
GTLServiceAnalytics *service = [[GTLServiceAnalytics alloc] init];
service.authorizer=self.auth;
GTLQueryAnalytics *query = [GTLQueryAnalytics queryForDataGaGetWithIds:@"ga:79891549" startDate:@"2006-01-01" endDate:@"today" metrics:@"ga:totalEvents"];
//GTLQueryAnalytics *query = [GTLQueryAnalytics queryForManagementAccountsList];
GTLServiceTicket *ticket = [service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
if (error == nil) {
myGTL=object;
}
}];
}