|
@@ -102,7 +102,6 @@ |
|
@@ -102,7 +102,6 @@ |
102
|
|
102
|
|
103
|
- (void)reportUploadError:(AFHTTPRequestOperation *)operation withResponse:(id)responseObject
|
103
|
- (void)reportUploadError:(AFHTTPRequestOperation *)operation withResponse:(id)responseObject
|
104
|
{
|
104
|
{
|
105
|
-#ifdef APPYOHO
|
|
|
106
|
if (operation.response.statusCode == 200) {
|
105
|
if (operation.response.statusCode == 200) {
|
107
|
return;
|
106
|
return;
|
108
|
}
|
107
|
}
|
|
@@ -112,7 +111,7 @@ |
|
@@ -112,7 +111,7 @@ |
112
|
NSString *body = [[NSString alloc] initWithData:operation.request.HTTPBody encoding:NSUTF8StringEncoding];
|
111
|
NSString *body = [[NSString alloc] initWithData:operation.request.HTTPBody encoding:NSUTF8StringEncoding];
|
113
|
id response = nil;
|
112
|
id response = nil;
|
114
|
|
113
|
|
115
|
- if (IsDictionaryClass(responseObject)) {
|
114
|
+ if (YAIsDictionaryClass(responseObject)) {
|
116
|
response = responseObject;
|
115
|
response = responseObject;
|
117
|
} else {
|
116
|
} else {
|
118
|
response = [responseObject description];
|
117
|
response = [responseObject description];
|
|
@@ -126,32 +125,30 @@ |
|
@@ -126,32 +125,30 @@ |
126
|
parameters[JsonKeyErrorEC] = @(code);
|
125
|
parameters[JsonKeyErrorEC] = @(code);
|
127
|
}
|
126
|
}
|
128
|
|
127
|
|
129
|
- if (!IsStrEmpty(url)) {
|
128
|
+ if (!YAIsStrEmpty(url)) {
|
130
|
parameters[JsonKeyErrorEI] = url;
|
129
|
parameters[JsonKeyErrorEI] = url;
|
131
|
}
|
130
|
}
|
132
|
- if (!IsStrEmpty(method)) {
|
131
|
+ if (!YAIsStrEmpty(method)) {
|
133
|
parameters[JsonKeyErrorMethod] = method;
|
132
|
parameters[JsonKeyErrorMethod] = method;
|
134
|
}
|
133
|
}
|
135
|
- if (!IsStrEmpty(body)) {
|
134
|
+ if (!YAIsStrEmpty(body)) {
|
136
|
parameters[JsonKeyErrorBody] = body;
|
135
|
parameters[JsonKeyErrorBody] = body;
|
137
|
}
|
136
|
}
|
138
|
- if (!IsNilOrNull(response)) {
|
137
|
+ if (!YAIsNilOrNull(response)) {
|
139
|
parameters[JsonKeyErrorResponse] = response;
|
138
|
parameters[JsonKeyErrorResponse] = response;
|
140
|
}
|
139
|
}
|
141
|
[[YH_Analytics sharedInstance] logError:kErrorTypeREPORT parameters:parameters];
|
140
|
[[YH_Analytics sharedInstance] logError:kErrorTypeREPORT parameters:parameters];
|
142
|
-#endif
|
|
|
143
|
}
|
141
|
}
|
144
|
|
142
|
|
145
|
- (void)reportUplaodError:(AFHTTPRequestOperation *)operation withError:(NSError *)error
|
143
|
- (void)reportUplaodError:(AFHTTPRequestOperation *)operation withError:(NSError *)error
|
146
|
{
|
144
|
{
|
147
|
-#ifdef APPYOHO
|
|
|
148
|
if (!error) {
|
145
|
if (!error) {
|
149
|
return;
|
146
|
return;
|
150
|
}
|
147
|
}
|
151
|
NSString *url = operation.request.URL.absoluteString;
|
148
|
NSString *url = operation.request.URL.absoluteString;
|
152
|
NSString *method = [operation.request.HTTPMethod uppercaseString];
|
149
|
NSString *method = [operation.request.HTTPMethod uppercaseString];
|
153
|
NSString *body = [[NSString alloc] initWithData:operation.request.HTTPBody encoding:NSUTF8StringEncoding];
|
150
|
NSString *body = [[NSString alloc] initWithData:operation.request.HTTPBody encoding:NSUTF8StringEncoding];
|
154
|
- NSString *response = (*error).localizedDescription;
|
151
|
+ NSString *response = error.localizedDescription;
|
155
|
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
|
152
|
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
|
156
|
//超时返回是0,但是为了和android的统一性,ios修改成-1。
|
153
|
//超时返回是0,但是为了和android的统一性,ios修改成-1。
|
157
|
if (operation.response.statusCode == 0) {
|
154
|
if (operation.response.statusCode == 0) {
|
|
@@ -160,20 +157,20 @@ |
|
@@ -160,20 +157,20 @@ |
160
|
parameters[JsonKeyErrorEC] = @(operation.response.statusCode);
|
157
|
parameters[JsonKeyErrorEC] = @(operation.response.statusCode);
|
161
|
}
|
158
|
}
|
162
|
|
159
|
|
163
|
- if (!IsStrEmpty(url)) {
|
160
|
+ if (!YAIsStrEmpty(url)) {
|
164
|
parameters[JsonKeyErrorEI] = url;
|
161
|
parameters[JsonKeyErrorEI] = url;
|
165
|
}
|
162
|
}
|
166
|
- if (!IsStrEmpty(method)) {
|
163
|
+ if (!YAIsStrEmpty(method)) {
|
167
|
parameters[JsonKeyErrorMethod] = method;
|
164
|
parameters[JsonKeyErrorMethod] = method;
|
168
|
}
|
165
|
}
|
169
|
- if (!IsStrEmpty(body)) {
|
166
|
+ if (!YAIsStrEmpty(body)) {
|
170
|
parameters[JsonKeyErrorBody] = body;
|
167
|
parameters[JsonKeyErrorBody] = body;
|
171
|
}
|
168
|
}
|
172
|
- if (!IsStrEmpty(response)) {
|
169
|
+ if (!YAIsStrEmpty(response)) {
|
173
|
parameters[JsonKeyErrorResponse] = response;
|
170
|
parameters[JsonKeyErrorResponse] = response;
|
174
|
}
|
171
|
}
|
175
|
[[YH_Analytics sharedInstance] logError:kErrorTypeREPORT parameters:parameters];
|
172
|
[[YH_Analytics sharedInstance] logError:kErrorTypeREPORT parameters:parameters];
|
176
|
-#endif
|
173
|
+
|
177
|
}
|
174
|
}
|
178
|
|
175
|
|
179
|
- (AFHTTPRequestOperation *)uploadLogcustomURL:(NSString *)url parameters:(NSDictionary *)parameters completionBlock:(void (^)(BOOL success, NSError *error))block
|
176
|
- (AFHTTPRequestOperation *)uploadLogcustomURL:(NSString *)url parameters:(NSDictionary *)parameters completionBlock:(void (^)(BOOL success, NSError *error))block
|