Skip to content

Instantly share code, notes, and snippets.

@jakemoore
Created February 2, 2013 04:58
Show Gist options
  • Save jakemoore/4696159 to your computer and use it in GitHub Desktop.
Save jakemoore/4696159 to your computer and use it in GitHub Desktop.
- (void)validateInviteCode:(NSString *)inviteCode
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id JSON))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON))failure
{
// Build parameters
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:inviteCode forKey:@"invite_code"];
// Send request
NSMutableURLRequest *req = [self requestWithMethod:@"POST" path:@"registration/family" parameters:params];
self.parameterEncoding = AFJSONParameterEncoding; // MUST BE SET TO ENSURE CORRECT ENCODING
[[AFJSONRequestOperation JSONRequestOperationWithRequest:req
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
success(request, response, JSON);
} failure:^(NSURLRequest *request , NSHTTPURLResponse *response , NSError *error, id JSON) {
failure(request, response, error, JSON);
}] start];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment