...
|
...
|
@@ -33,7 +33,7 @@ |
|
|
{
|
|
|
self = [super init];
|
|
|
if (self) {
|
|
|
self.httpClient = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:kURLAnalyticsService]];
|
|
|
self.httpClient = [AFHTTPRequestOperationManager manager];
|
|
|
self.httpClient.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
|
|
|
self.httpClient.securityPolicy.allowInvalidCertificates = YES;
|
|
|
self.httpClient.operationQueue.maxConcurrentOperationCount = 6;
|
...
|
...
|
@@ -78,7 +78,37 @@ |
|
|
NSString *parsJsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
NSDictionary *newParameters = @{@"_mlogs": kSafeValue(parsJsonStr)};
|
|
|
|
|
|
return [self.httpClient POST:kYASApiMethodUploadData priority:NSOperationQueuePriorityLow parameters:newParameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
|
|
return [self.httpClient POST:kURLAnalyticsService priority:NSOperationQueuePriorityLow parameters:newParameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
|
|
|
|
|
if (block) {
|
|
|
block(YES, nil);
|
|
|
}
|
|
|
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
|
|
if (block) {
|
|
|
block(NO, error);
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
- (AFHTTPRequestOperation *)uploadLogcustomURL:(NSString *)url parameters:(NSDictionary *)parameters completionBlock:(void (^)(BOOL success, NSError *error))block
|
|
|
{
|
|
|
NSError *error = nil;
|
|
|
NSMutableDictionary *actualParameters = [NSMutableDictionary dictionaryWithDictionary:parameters];
|
|
|
|
|
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:actualParameters options:0 error:&error];
|
|
|
if (error) {
|
|
|
YALog(@"json parsing, connot convert to json for: %@\n code: %ld\n reason: %@", actualParameters, (long)[error code], [error localizedDescription]);
|
|
|
|
|
|
if (block) {
|
|
|
block(NO, error);
|
|
|
}
|
|
|
return nil;
|
|
|
}
|
|
|
|
|
|
NSString *parsJsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
NSDictionary *newParameters = @{@"_mlogs": kSafeValue(parsJsonStr)};
|
|
|
|
|
|
return [self.httpClient POST:url priority:NSOperationQueuePriorityLow parameters:newParameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
|
|
|
|
|
if (block) {
|
|
|
block(YES, nil);
|
...
|
...
|
|