axmol/plugin/plugins/umeng/platform/ios/MobClick.h

351 lines
14 KiB
C
Raw Normal View History

2013-04-07 16:58:26 +08:00
//
// MobClick.h
// MobClick
//
// Created by Aladdin on 2010-03-25.
// Updated by Minghua on 2013-04-01.
2013-04-07 16:58:26 +08:00
// Copyright 2010-2012 Umeng.com . All rights reserved.
// Version 2.2.0.OpenUDID, updated_at 2013-04-01.
2013-04-07 16:58:26 +08:00
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#define UMOnlineConfigDidFinishedNotification @"OnlineConfigDidFinishedNotification"
#define XcodeAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
2013-04-07 16:58:26 +08:00
typedef enum {
REALTIME = 0, //实时发送
BATCH = 1, //启动发送
SENDDAILY = 4, //每日发送
SENDWIFIONLY = 5, //仅在WIFI下启动时发送
SEND_INTERVAL = 6, //按最小间隔发送
SEND_ON_EXIT = 7 //退出或进入后台时发送
2013-04-07 16:58:26 +08:00
} ReportPolicy;
@protocol MobClickDelegate;
@class CLLocation;
/** MobClick是统计的核心类本身不需要实例化所有方法以类方法的形式提供.
REALTIME,BATCH,SENDDAILY,SENDWIFIONLY,SEND_INTERVAL,SEND_ON_EXIT
REALTIME,SENDWIFIONLY DEBUG模式下生效release模式会自动改成BATCH
http://blog.umeng.com/index.php/2012/12/0601/
SEND_INTERVAL ,10,10 86400() 10
SEND_ON_EXIT 退,App运行过程中不发送
iOS > 4.0, iOS < 4.0 BATCH
*/
2013-04-07 16:58:26 +08:00
@interface MobClick : NSObject <UIAlertViewDelegate> {
@private
id _internal;
}
#pragma mark basics
///---------------------------------------------------------------------------------------
/// @name 设置
///---------------------------------------------------------------------------------------
/** 设置app版本号。由于历史原因需要和xcode3工程兼容,友盟提取的是Build号(CFBundleVersion),如果需要和App Store上的版本一致,需要调用此方法。
@param appVersion `XcodeAppVersion`.
@return void.
*/
2013-04-07 16:58:26 +08:00
+ (void)setAppVersion:(NSString *)appVersion;
/** 开启CrashReport收集, 默认是开启状态.
@param value NO,CrashReport收集.
@return void.
*/
2013-04-07 16:58:26 +08:00
+ (void)setCrashReportEnabled:(BOOL)value;
/** 设置是否打印sdk的log信息,默认不开启
@param value YES,umeng SDK log信息,release产品时要设置回NO.
@return .
@exception .
2013-04-07 16:58:26 +08:00
*/
2013-04-07 16:58:26 +08:00
+ (void)setLogEnabled:(BOOL)value;
///---------------------------------------------------------------------------------------
/// @name 开启统计
///---------------------------------------------------------------------------------------
/** 开启友盟统计,默认以BATCH方式发送log.
@param appKey appKey.
@param reportPolicy .
@param channelId ,nil或@"",@"App Store"
@return void
*/
+ (void)startWithAppkey:(NSString *)appKey;
+ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
/** 当reportPolicy == SEND_INTERVAL 时设定log发送间隔
@param second ,10,86400().
@return void.
*/
+ (void)setLogSendInterval:(double)second;
///---------------------------------------------------------------------------------------
/// @name 页面计时
///---------------------------------------------------------------------------------------
/** 页面时长统计,记录某个view被打开多长时间,可以自己计时也可以调用beginLogPageView,endLogPageView自动计时
@param pageName view名称.
@param seconds int型.
@return void.
*/
2013-04-07 16:58:26 +08:00
+ (void)logPageView:(NSString *)pageName seconds:(int)seconds;
+ (void)beginLogPageView:(NSString *)pageName;
+ (void)endLogPageView:(NSString *)pageName;
#pragma mark event logs
///---------------------------------------------------------------------------------------
/// @name 事件统计
///---------------------------------------------------------------------------------------
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
@param eventId Id.
@param label 便,nil或空字符串时后台会生成和eventId同名的标签.
@param accumulation ID的某一分类标签进行累加
@return void.
*/
2013-04-07 16:58:26 +08:00
+ (void)event:(NSString *)eventId; //等同于 event:eventId label:eventId;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
2013-04-07 16:58:26 +08:00
+ (void)event:(NSString *)eventId label:(NSString *)label; // label为nil或@""时,等同于 event:eventId label:eventId;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
2013-04-07 16:58:26 +08:00
+ (void)event:(NSString *)eventId acc:(NSInteger)accumulation;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
2013-04-07 16:58:26 +08:00
+ (void)event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation;
/** 自定义事件,数量统计.
使App管理后台的设置-> IDID
*/
2013-04-07 16:58:26 +08:00
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
beginEvent,endEvent要配对使用,durations参数传递进来
@param eventId Id.
@param label 便,nil或空字符串时后台会生成和eventId同名的标签.
@param primarykey event_id一起标示一个唯一事件beginEvent和endEvent eventId primarykey
@param millisecond
@return void.
@warning event的attributes不能超过10个
eventIdattributes中key和value都不能使用空格和特殊字符eventIdattributes的key最大为128个bytes(12842)labelattributes的value最大为256个bytes(25684),
eventId超过的将抛弃不再发送
id ts du是保留字段eventId及key的名称
*/
2013-04-07 16:58:26 +08:00
+ (void)beginEvent:(NSString *)eventId;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
2013-04-07 16:58:26 +08:00
+ (void)endEvent:(NSString *)eventId;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
2013-04-07 16:58:26 +08:00
+ (void)beginEvent:(NSString *)eventId label:(NSString *)label;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
2013-04-07 16:58:26 +08:00
+ (void)endEvent:(NSString *)eventId label:(NSString *)label;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
2013-04-07 16:58:26 +08:00
+ (void)beginEvent:(NSString *)eventId primarykey :(NSString *)keyName attributes:(NSDictionary *)attributes;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
2013-04-07 16:58:26 +08:00
+ (void)endEvent:(NSString *)eventId primarykey:(NSString *)keyName;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
*/
2013-04-07 16:58:26 +08:00
+ (void)event:(NSString *)eventId durations:(int)millisecond;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
2013-04-07 16:58:26 +08:00
*/
+ (void)event:(NSString *)eventId label:(NSString *)label durations:(int)millisecond;
/** 自定义事件,时长统计.
使App管理后台的设置-> IDID.
2013-04-07 16:58:26 +08:00
*/
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes durations:(int)millisecond;
///---------------------------------------------------------------------------------------
/// @name 按渠道自动更新
///---------------------------------------------------------------------------------------
/** 按渠道自动更新检测
app是否有更新UIAlertView提示用户,app会跳转到您预先设置的网址
app版本信息App Store.
MobClickDelegate的appUpdate方法
@param title UIAlertView的title.
@param cancelTitle UIAlertView的cancelTitle.
@param otherTitle UIAlertView的otherTitle.
@param delegate checkUpdate的对象.
@param callBackSelectorWithDictionary checkUpdate事件完成时此方法会被调用,app更新信息的字典被传回.
@return void.
*/
2013-04-07 16:58:26 +08:00
+ (void)checkUpdate;
/** 按渠道自动更新检测
*/
2013-04-07 16:58:26 +08:00
+ (void)checkUpdate:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherTitle;
/** 按渠道自动更新检测
*/
2013-04-07 16:58:26 +08:00
+ (void)checkUpdateWithDelegate:(id)delegate selector:(SEL)callBackSelectorWithDictionary;
///---------------------------------------------------------------------------------------
/// @name 在线参数
///---------------------------------------------------------------------------------------
/** 使用在线参数功能,可以让你动态修改应用中的参数值,
线,[NSUserDefaults standardUserDefaults],
线SDK端发送策略的功能,线.
[MobClick startWithAppkey:];
线UMOnlineConfigDidFinishedNotification
@param .
@return void.
2013-04-07 16:58:26 +08:00
*/
2013-04-07 16:58:26 +08:00
+ (void)updateOnlineConfig;
/** 从[NSUserDefaults standardUserDefaults]获取缓存的在线参数的数值
key的值线.
updateOnlineConfig才能使用,线UMOnlineConfigDidFinishedNotification
@param key
@return (NSString *) .
2013-04-07 16:58:26 +08:00
*/
2013-04-07 16:58:26 +08:00
+ (NSString *)getConfigParams:(NSString *)key;
/** 从[NSUserDefaults standardUserDefaults]获取缓存的在线参数
@return (NSDictionary *).
*/
2013-04-07 16:58:26 +08:00
+ (NSDictionary *)getConfigParams;
///---------------------------------------------------------------------------------------
/// @name 地理位置设置
///---------------------------------------------------------------------------------------
/** 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息
CoreLocation.framework #import <CoreLocation/CoreLocation.h>
@param latitude .
@param longitude .
@param location CLLocation *
@return void
*/
2013-04-07 16:58:26 +08:00
+ (void)setLatitude:(double)latitude longitude:(double)longitude;
/** 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息
*/
2013-04-07 16:58:26 +08:00
+ (void)setLocation:(CLLocation *)location;
///---------------------------------------------------------------------------------------
/// @name helper方法
///---------------------------------------------------------------------------------------
2013-04-07 16:58:26 +08:00
/** 判断设备是否越狱,判断方法根据 apt和Cydia.app的path来判断
*/
2013-04-07 16:58:26 +08:00
+ (BOOL)isJailbroken;
/** 判断你的App是否被破解
*/
2013-04-07 16:58:26 +08:00
+ (BOOL)isPirated;
#pragma mark DEPRECATED methods from version 1.7
/** 设置MobClick代理,已经startWithAppkey:所取代,不要再使用,原有代码可以删除
*/
2013-04-07 16:58:26 +08:00
+ (void)setDelegate:(id)delegate;
+ (void)setDelegate:(id)delegate reportPolicy:(ReportPolicy)rp;
/** 记录启动时间,模块开始启用,不要再使用,原有代码可以删除
*/
2013-04-07 16:58:26 +08:00
+ (void)appLaunched;
/** 记录软件终止时间,模块终止,不要再使用,原有代码可以删除
2013-04-07 16:58:26 +08:00
*/
2013-04-07 16:58:26 +08:00
+ (void)appTerminated;
/** 友盟模块启动
[MobClick startWithAppkey:]application:didFinishLaunchingWithOptions:
App启动和退出事件application:didFinishLaunchingWithOptions:[MobClick startWithAppkey:]
App的启动事件可能会无法监听[MobClick startSession:nil]session
app里app使用不到.
2013-04-07 16:58:26 +08:00
*/
2013-04-07 16:58:26 +08:00
+ (void)startSession:(NSNotification *)notification;
/** 获取友盟sdk 版本号,目前友盟模块启动时自动调用,不要再使用,原有代码可以删除
*/
+ (NSString *)getAgentVersion; //
2013-04-07 16:58:26 +08:00
@end
/** MobClickDelegate protocol
使
+ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
+ (void)checkUpdate:(id)delegate selector:(SEL)callBackSelector;
*/
2013-04-07 16:58:26 +08:00
@protocol MobClickDelegate <NSObject>
@optional
- (NSString *)appKey;
- (NSString *)channelId;
- (void)appUpdate:(NSDictionary *)appUpdateInfo;
@end