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

350 lines
13 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 2012-09-11.
// Copyright 2010-2012 Umeng.com . All rights reserved.
// Version 2.1.0 , updated_at 2012-09-11.
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#define UMOnlineConfigDidFinishedNotification @"OnlineConfigDidFinishedNotification"
typedef enum {
REALTIME = 0, //实时发送
BATCH = 1, //启动发送
SENDDAILY = 4, //每日发送
SENDWIFIONLY = 5 //仅在WIFI下启动时发送
} ReportPolicy;
@protocol MobClickDelegate;
@class CLLocation;
@interface MobClick : NSObject <UIAlertViewDelegate> {
@private
id _internal;
}
#pragma mark basics
//开启友盟统计,以BATCH方式发送log.
+ (void)startWithAppkey:(NSString *)appKey;
// channelId 为nil或@""时,默认会被被当作@"App Store"渠道
+ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
/*
app版本信息CFBundleVersion里取,build version,xcode3工程兼容.
xcode4版本保持一致使
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
[MobClick setAppVersion:version];
*/
+ (void)setAppVersion:(NSString *)appVersion;
+ (NSString *)getAgentVersion; //获取友盟sdk 版本号
/*方法名:
* setCrashReportEnabled:(BOOL)value
*:
* umeng SDK crash log
*:
* (BOOL)value:YES
* NO,umeng SDK crash log,setDelegate方法之前调用
*/
+ (void)setCrashReportEnabled:(BOOL)value;
/*方法名:
* setLogEnabled:(BOOL)value
*:
* sdk的log信息
*:
* (BOOL)value:NO
* YES,umeng SDK log信息,release产品时要设置回NO
*/
+ (void)setLogEnabled:(BOOL)value;
/*方法名:
* logPageView:seconds:
*:
* view打开多长时间.
*
*:
* pageName NSString *
* seconds int型
*
*
*
*:
*
*
*: http://dev.umeng.com/doc/document_ana_ios.html#8
*/
+ (void)logPageView:(NSString *)pageName seconds:(int)seconds;
+ (void)beginLogPageView:(NSString *)pageName;
+ (void)endLogPageView:(NSString *)pageName;
#pragma mark event logs
/*方法名:
* event:(NSString *)eventId
* event:(NSString *)eventId label:(NSString *)label
* event:(NSString *)eventId acc:(NSInteger)accumulation
* event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation
*:
* 使App管理后台的设置-> IDID即可
*
*:
* 便1
* label:ID添加该事件的分类标签统计ID进行统计和整理ID的不同的标签便
* accumulation:ID的某一分类标签进行累加
*
*: http://dev.umeng.com/doc/document_ana_ios.html#3
*/
//如果label为nil或@""时服务器端会生成一个unknown的默认label,
//为避免这种情况,2.0.0之后label为nil或@""时,label将被赋值为eventId
//详细文档参见 iOS统计分析SDK开发指南.html 或在线文档
//http://dev.umeng.com/doc/document_ana_ios.html#3
+ (void)event:(NSString *)eventId; //等同于 event:eventId label:eventId;
+ (void)event:(NSString *)eventId label:(NSString *)label; // label为nil或@""时,等同于 event:eventId label:eventId;
+ (void)event:(NSString *)eventId acc:(NSInteger)accumulation;
+ (void)event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation;
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes;
+ (void)beginEvent:(NSString *)eventId;
+ (void)endEvent:(NSString *)eventId;
+ (void)beginEvent:(NSString *)eventId label:(NSString *)label;
+ (void)endEvent:(NSString *)eventId label:(NSString *)label;
//primarykey这个参数用于和event_id一起标示一个唯一事件并不会被统计
//对于同一个事件在beginEvent和endEvent 中要传递相同的eventId 和 primarykey
//每个event的attributes不能超过10个
//eventId、attributes中key和value都不能使用空格和特殊字符且长度不能超过255个字符否则将截取前255个字符
//id ts du是保留字段不能作为eventId及key的名称
+ (void)beginEvent:(NSString *)eventId primarykey :(NSString *)keyName attributes:(NSDictionary *)attributes;
+ (void)endEvent:(NSString *)eventId primarykey:(NSString *)keyName;
//时间单位为毫秒 microseconds
+ (void)event:(NSString *)eventId durations:(int)microseconds;
+ (void)event:(NSString *)eventId label:(NSString *)label durations:(int)microseconds;
+ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes durations:(int)microseconds;
#pragma mark feedback Default GUI
/*方法名:
- * showFeedback:(UIViewController *)rootViewcontroller
- *:
- *
- *:
- * rootViewController:presentModalViewController方法来展示反馈界面
- * rootViewController非空
- *
- * 使SDK
- */
+ (void)showFeedback:(UIViewController *)rootViewController;
#pragma mark feedback data api
/*方法名:
* feedbackWithDictionary:(NSDictionary * )feedbackDict
*:
*
*:
* Dictionary中应该有以下三个键名:
* @"UMengFeedbackGender" @"UMengFeedbackAge" @"UMengFeedbackContent"
* :
* NSString类型的
* 1=> 2=>
*
* 1=>18(18),2=>18-24,3=>25-30,
* 4=>31-35,5=>36-40,6=>41-50,7=>51-59,8=>6060
*
*
*
*:
*
*
*
* 使SDK
*/
+ (void)feedbackWithDictionary:(NSDictionary *)feedbackDict;
#pragma mark check app update
/*方法名:
* checkUpdate
* checkUpdateWithTitle:CancelButtonTitle:OtherButtonTitle:
*:
* app是否有更新UIAlertView提示用户,app会跳转到您预先设置的网址
*
* app版本信息App Store.
* checkUpdate .
*
*:
* checkUpdate
* checkUpdate:cancelButtonTitle:otherButtonTitles: :
* title UIAlertView的title
* cancelTitle UIAlertView的cancelTitle
* otherTitle UIAlertView的otherTitle
*
* [MobClick setDelegate:reportPolicy:];
* MobClickDelegate的appUpdate方法
*
*:
*
*
*: http://dev.umeng.com/doc/document_ana_ios.html#5
*/
+ (void)checkUpdate;
+ (void)checkUpdate:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherTitle;
+ (void)checkUpdateWithDelegate:(id)delegate selector:(SEL)callBackSelectorWithDictionary;
#pragma mark online config params
/*方法名:
* updateOnlineConfig
*:
* 线,[NSUserDefaults standardUserDefaults].
* 线SDK端发送策略的功能
* 线.
*
*:
*
*
* [MobClick setDelegate:reportPolicy:];
* 使线
*
*:
*
*
*: http://dev.umeng.com/doc/document_ana_ios.html#6
*/
+ (void)updateOnlineConfig;
/*方法名:
* getConfigParams
* getConfigParams:
*:
* [NSUserDefaults standardUserDefaults]线.
* key的值线.
*
*:
* NSString *
*
* [NSUserDefaults standardUserDefaults],
* updateOnlineConfig方法要先在app启动时被调用
*
*:
* (NSString *) (NSDictionary *)
*
*: http://dev.umeng.com/doc/document_ana_ios.html#6
*/
+ (NSString *)getConfigParams:(NSString *)key;
+ (NSDictionary *)getConfigParams;
// 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息
// 需要链接 CoreLocation.framework 并且 #import <CoreLocation/CoreLocation.h>
+ (void)setLatitude:(double)latitude longitude:(double)longitude;
+ (void)setLocation:(CLLocation *)location;
#pragma mark helper
/*方法名:
* isJailbroken
*:
* apt和Cydia.app的path来判断
*:
*
*
*
*/
#pragma mark utils api
// 类方法,判断当前设备是否已经越狱
+ (BOOL)isJailbroken;
// 类方法判断你的App是否被破解
+ (BOOL)isPirated;
#pragma mark DEPRECATED methods from version 1.7
/*方法名:
* setDelegate:(id<MobClickDelegate>)delegate
* setDelegate:(id<MobClickDelegate>)delegate reportPolicy:(ReportPolicy)rp;
*:
* startWithAppkey:(NSString *)appKey ;
* MobClickDelegate实现使.
* MobClick代理MobClick实例appLaunched方法前
*:
* delegate:MobClickDelegate协议的实例
* ReportPolicy:
* 1.BATCH :
* 2.REALTIME :event
*
*/
+ (void)setDelegate:(id)delegate;
+ (void)setDelegate:(id)delegate reportPolicy:(ReportPolicy)rp;
/*方法名:
* appLaunched
*:
* setDelegate: setDelegate: reportPolicy:
*:
*
*
* 1.6.7.
*/
+ (void)appLaunched;
/*方法名:
* appTerminated
*:
*
*:
*
* 1.6.7.
*/
+ (void)appTerminated;
/*
SDK内部使用的监听方法App启动退
[MobClick startWithAppkey:]application:didFinishLaunchingWithOptions:
App启动和退出事件application:didFinishLaunchingWithOptions:[MobClick startWithAppkey:]
App的启动事件可能会无法监听[MobClick startSession:nil]session
*/
+ (void)startSession:(NSNotification *)notification;
@end
//此协议的三个方法不再建议使用,建议用新方法代替
//+ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid;
//+ (void)checkUpdate:(id)delegate selector:(SEL)callBackSelector;
@protocol MobClickDelegate <NSObject>
@optional
/*方法名:
* - (NSString *)appKey;
*:
* AppkeyAppkey错误log进行记录
*:
* Appkey是从友盟后台注册新App得到的
*
*/
- (NSString *)appKey;
/*方法名:
* - (NSString *)channelId;
*:
* ChannelID
*:
* @"Apple Store",@"产品主页"
* 使
*
*/
- (NSString *)channelId;
/*方法名:
* - (void)appUpdate:(NSMutableDictionary *)updateInfo;
*:
*
*:
* [MobClick checkUpdate]appUpdate
* updateInfo是与此app版本信息相关的参数
*
*
*
*/
- (void)appUpdate:(NSDictionary *)appUpdateInfo;
@end