...
|
...
|
@@ -275,11 +275,13 @@ static dispatch_queue_t persisting_queue() { |
|
|
- (void)savePerformanceData:(YHPerformance *)perf
|
|
|
{
|
|
|
if (perf == nil || ![perf isKindOfClass:[YHPerformance class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
|
|
|
#endif
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ([self canPersisting]) {
|
...
|
...
|
@@ -298,10 +300,13 @@ static dispatch_queue_t persisting_queue() { |
|
|
- (void)saveItemData:(YHAnalyItemData *)itemData
|
|
|
{
|
|
|
if (itemData == nil || ![itemData isKindOfClass:[YHAnalyItemData class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ([self canPersisting]) {
|
...
|
...
|
@@ -344,28 +349,35 @@ static dispatch_queue_t persisting_queue() { |
|
|
}
|
|
|
|
|
|
} else {
|
|
|
#ifdef DEBUG
|
|
|
// 不处理非 Event 和 Error 类型的数据
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
}
|
|
|
#endif
|
|
|
} else {
|
|
|
#ifdef DEBUG
|
|
|
// 不能存储
|
|
|
NSException *exception = [NSException exceptionWithName:NSMallocException
|
|
|
reason:@"Can't create folder for persisting."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (void)uploadImmedilyWithEvent:(YHAnalyItemData *)itemData
|
|
|
{
|
|
|
if (itemData == nil || ![itemData isKindOfClass:[YHAnalyItemData class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (itemData.dataType == YHItemDataTypeEvent) {
|
...
|
...
|
@@ -421,11 +433,13 @@ static dispatch_queue_t persisting_queue() { |
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
#ifdef DEBUG
|
|
|
// 不处理非 Event 和 Error 类型的数据
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -548,11 +562,12 @@ static dispatch_queue_t persisting_queue() { |
|
|
- (BOOL)updateLocation:(CLLocation *)location
|
|
|
{
|
|
|
if (location == nil || ![location isKindOfClass:[CLLocation class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
|
|
|
#endif
|
|
|
return NO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -582,10 +597,12 @@ static dispatch_queue_t persisting_queue() { |
|
|
[allStatus replaceObjectAtIndex:0 withObject:self.currentStatus.jsonDictionary];
|
|
|
[self.immediUploadItemDic setObject:allStatus forKey:JsonKeyDataTypeStatus];
|
|
|
} else {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSGenericException
|
|
|
reason:@"appId and sessionId do not be initialized. Please use prepareImmediUploadDic:sessionId:channelId: first."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -594,10 +611,12 @@ static dispatch_queue_t persisting_queue() { |
|
|
- (BOOL)writeEventToFile:(YHEvent *)event
|
|
|
{
|
|
|
if (event == nil || ![event isKindOfClass:[YHEvent class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
return NO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -666,10 +685,12 @@ static dispatch_queue_t persisting_queue() { |
|
|
{
|
|
|
performanceData.net = self.currentStatus.net;
|
|
|
if (performanceData == nil || ![performanceData isKindOfClass:[YHPerformance class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
return NO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -739,10 +760,12 @@ static dispatch_queue_t persisting_queue() { |
|
|
- (BOOL)writeErrorToFile:(YHError *)errorData;
|
|
|
{
|
|
|
if (errorData == nil || ![errorData isKindOfClass:[YHError class]]) {
|
|
|
#ifdef DEBUG
|
|
|
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
|
|
|
reason:@"The input parameter is nil or an unexpected value."
|
|
|
userInfo:nil];
|
|
|
[exception raise];
|
|
|
#endif
|
|
|
return NO;
|
|
|
}
|
|
|
|
...
|
...
|
|