Commit 9d8fa498 authored by jinzhu's avatar jinzhu

埋点加判断不能传 object

parent e56ff462
...@@ -271,13 +271,21 @@ static NSString *sdkVersion = @"110"; ...@@ -271,13 +271,21 @@ static NSString *sdkVersion = @"110";
} }
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow{ + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow{
NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes]; NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes];
if (sendNow) { @try {
NSArray *array = @[dict]; NSData *JSON = [PhobosUtil encodeJSON:dict];
// 实时发送的埋点,不能立即清楚缓存 if (sendNow) {
[sharedClient sendArray:array cleanCacheRightNow:NO]; NSArray *array = @[dict];
}else{ // 实时发送的埋点,不能立即清楚缓存
[sharedClient save:dict]; [sharedClient sendArray:array cleanCacheRightNow:NO];
}else{
[sharedClient save:dict];
}
}
@catch (NSException *exception) {
NSAssert(NO, @"哎呀呀,VALUE只不能为NSObject ");
} }
} }
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI { + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI {
...@@ -291,13 +299,22 @@ static NSString *sdkVersion = @"110"; ...@@ -291,13 +299,22 @@ static NSString *sdkVersion = @"110";
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI { + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI {
[sharedClient addNewApi:currentAPI]; // 记录新的API [sharedClient addNewApi:currentAPI]; // 记录新的API
NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes]; NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes];
if (sendNow) {
NSArray *array = @[dict]; @try {
// 实时发送的埋点,不能立即清楚缓存 NSData *JSON = [PhobosUtil encodeJSON:dict];
[sharedClient sendArray:array currentAPI:currentAPI cleanCacheRightNow:NO]; if (sendNow) {
}else{ NSArray *array = @[dict];
[sharedClient save:dict currentAPI:currentAPI]; // 实时发送的埋点,不能立即清楚缓存
[sharedClient sendArray:array currentAPI:currentAPI cleanCacheRightNow:NO];
}else{
[sharedClient save:dict currentAPI:currentAPI];
}
}
@catch (NSException *exception) {
NSAssert(NO, @"哎呀呀,VALUE只不能为NSObject ");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment