Permalink
Browse files

Added tag v2.1

  • Loading branch information...
1 parent 4aca716 commit c93c477d1289c2b00f3133d18dda6d27f1839974 @dalezak dalezak committed May 28, 2012
@@ -884,6 +884,7 @@ - (BOOL) uploadIncident:(Incident *)incident forDelegate:(id<UshahidiDelegate>)d
}
}
}
+ DLog(@"POST: %@", [post stringValues]);
[self.uploadQueue addOperation:post];
return YES;
}
@@ -915,14 +916,17 @@ - (void)uploadIncidentFinished:(ASIHTTPRequest *)request {
incident.uploading = NO;
NSError *error = nil;
if ([request responseStatusCode] != HttpStatusOK) {
+ DLog(@"ERROR: %@", error);
+ DLog(@"STATUS CODE: %@", [request responseStatusCode]);
+ DLog(@"STATUS MESSAGE: %@", [request responseStatusMessage]);
incident.errors = [request responseStatusMessage];
error = [NSError errorWithDomain:self.deployment.domain
code:[request responseStatusCode]
message:[request responseStatusMessage]];
}
else {
NSDictionary *json = [[request responseString] JSONValue];
- if (json == nil) {
+ if (json == nil) {
DLog(@"RESPONSE: %@", [request responseString]);
incident.errors = NSLocalizedString(@"Unable To Upload Report", nil);
error = [NSError errorWithDomain:self.deployment.domain
@@ -944,13 +948,15 @@ - (void)uploadIncidentFinished:(ASIHTTPRequest *)request {
objects:self, [self.deployment.incidents allValues], self.deployment.pending, nil, YES, nil];
}
else {
- NSDictionary *messages = [json objectForKey:@"error"];
+ DLog(@"JSON: %@", json);
+ NSDictionary *messages = [json objectForKey:@"error"];
if (messages != nil) {
incident.errors = [messages objectForKey:@"message"];
}
else {
incident.errors = NSLocalizedString(@"Unable To Upload Report", nil);
}
+ DLog(@"ERROR: %@", messages);
error = [NSError errorWithDomain:self.deployment.domain
code:HttpStatusInternalServerError
message:incident.errors];
@@ -35,6 +35,8 @@ typedef enum _ASIPostFormat {
}
+- (NSString*) stringValues;
+
#pragma mark utilities
- (NSString*)encodeURL:(NSString *)string;
@@ -64,6 +64,14 @@ - (void)dealloc
#pragma mark setup request
+- (NSString*) stringValues {
+ NSMutableString *string = [NSMutableString string];
+ for (NSDictionary *dict in [self postData]) {
+ [string appendFormat:@"%@=%@\n", [dict objectForKey:@"key"], [dict objectForKey:@"value"]];
+ }
+ return string;
+}
+
- (void)addPostValue:(id <NSObject>)value forKey:(NSString *)key
{
if (value == nil) {

0 comments on commit c93c477

Please sign in to comment.