...
|
...
|
@@ -346,6 +346,8 @@ static dispatch_queue_t persisting_queue() { |
|
|
if (itemData.dataType == YHItemDataTypeEvent) {
|
|
|
YHEvent *event = (YHEvent *)itemData;
|
|
|
if (event) {
|
|
|
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypePerfor];
|
|
|
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypeErrors];
|
|
|
[self.immediUploadItemDic setObject:[[NSMutableArray alloc]initWithObjects:event.jsonDictionary, nil] forKey:JsonKeyDataTypeEvents];
|
|
|
|
|
|
[[YHNetworkService sharedInstance] uploadLogData:self.immediUploadItemDic completionBlock:^(BOOL success, NSError *error) {
|
...
|
...
|
@@ -360,6 +362,8 @@ static dispatch_queue_t persisting_queue() { |
|
|
YHPerformance *perfms = (YHPerformance *)itemData;
|
|
|
perfms.net = self.currentStatus.net;
|
|
|
if (perfms) {
|
|
|
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypeEvents];
|
|
|
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypeErrors];
|
|
|
[self.immediUploadItemDic setObject:[[NSMutableArray alloc]initWithObjects:perfms.jsonDictionary, nil] forKey:JsonKeyDataTypePerfor];
|
|
|
|
|
|
[[YHNetworkService sharedInstance] uploadLogData:self.immediUploadItemDic completionBlock:^(BOOL success, NSError *error) {
|
...
|
...
|
@@ -373,6 +377,8 @@ static dispatch_queue_t persisting_queue() { |
|
|
} else if(itemData.dataType == YHItemDataTypeError) {
|
|
|
YHError *error = (YHError *)itemData;
|
|
|
if (error) {
|
|
|
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypeEvents];
|
|
|
[self.immediUploadItemDic removeObjectForKey:JsonKeyDataTypePerfor];
|
|
|
[self.immediUploadItemDic setObject:[[NSMutableArray alloc]initWithObjects:error.jsonDictionary, nil] forKey:JsonKeyDataTypeErrors];
|
|
|
|
|
|
[[YHNetworkService sharedInstance] uploadLogData:self.immediUploadItemDic completionBlock:^(BOOL success, NSError *error) {
|
...
|
...
|
@@ -646,7 +652,7 @@ static dispatch_queue_t persisting_queue() { |
|
|
//组合performance信息
|
|
|
if (performanceData.jsonDictionary) {
|
|
|
NSMutableArray *events = [[NSMutableArray alloc]initWithObjects:performanceData.jsonDictionary,nil];
|
|
|
// self.allEventsCount = [events count];
|
|
|
// self.allEventsCount = [events count];
|
|
|
[collectData setObject:events forKey:JsonKeyDataTypePerfor];
|
|
|
}
|
|
|
|
...
|
...
|
@@ -672,12 +678,12 @@ static dispatch_queue_t persisting_queue() { |
|
|
oldPerformance = [[NSMutableArray alloc]init];
|
|
|
}
|
|
|
[oldPerformance addObject:performanceData.jsonDictionary];
|
|
|
// self.allEventsCount = [oldPerformance count];
|
|
|
// self.allEventsCount = [oldPerformance count];
|
|
|
[collectData setObject:oldPerformance forKey:JsonKeyDataTypePerfor];
|
|
|
|
|
|
} else {
|
|
|
NSMutableArray *newPerformance = [[NSMutableArray alloc]initWithObjects:performanceData.jsonDictionary, nil];
|
|
|
// self.allEventsCount = [newEvents count];
|
|
|
// self.allEventsCount = [newEvents count];
|
|
|
[collectData setObject:newPerformance forKey:JsonKeyDataTypePerfor];
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -882,7 +888,7 @@ static dispatch_queue_t persisting_queue() { |
|
|
[self.tempPerformanceArray removeAllObjects];
|
|
|
}
|
|
|
|
|
|
// self.allEventsCount = [eventJsonDicArray count];
|
|
|
// self.allEventsCount = [eventJsonDicArray count];
|
|
|
[collectData setObject:eventJsonDicArray forKey:JsonKeyDataTypePerfor];
|
|
|
|
|
|
} else { // 持久化文件不为空
|
...
|
...
|
@@ -916,7 +922,7 @@ static dispatch_queue_t persisting_queue() { |
|
|
[self.tempPerformanceArray removeAllObjects];
|
|
|
}
|
|
|
|
|
|
// self.allEventsCount = [oldEvents count];
|
|
|
// self.allEventsCount = [oldEvents count];
|
|
|
[collectData setObject:oldEvents forKey:JsonKeyDataTypePerfor];
|
|
|
|
|
|
} else {
|
...
|
...
|
@@ -951,6 +957,10 @@ static dispatch_queue_t persisting_queue() { |
|
|
if ([manager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
|
|
|
[manager requestAlwaysAuthorization];
|
|
|
}
|
|
|
|
|
|
// if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
|
|
|
// manager.allowsBackgroundLocationUpdates = YES;
|
|
|
// }
|
|
|
}
|
|
|
break;
|
|
|
case kCLAuthorizationStatusRestricted:
|
...
|
...
|
|