Created
June 21, 2013 12:37
-
-
Save thomasdegry/5830880 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setPaidOnServer | |
{ | |
[KGStatusBar showWithStatus: @"Validating your order"]; | |
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://student.howest.be"]]; | |
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" | |
path:[NSString stringWithFormat:@"thomas.degry/20122013/MAIV/FOOD/api/creations/pay/%@/%@", self.userID, self.burgerID] | |
parameters:nil]; | |
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; | |
[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]]; | |
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { | |
// Print the response body in text | |
NSLog(@"Response: %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]); | |
[KGStatusBar dismiss]; | |
[self delete]; | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSLog(@"Error: %@", error); | |
}]; | |
[operation start]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment