Created
May 3, 2017 06:17
-
-
Save EkkoG/4ef8fa19309afdcd95c87b779ee4dbd8 to your computer and use it in GitHub Desktop.
Custom http body use af 3.x
This file contains 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
NSMutableURLRequest *req = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:@"https://example.com" parameters:@{} error:nil]; | |
NSString *body = @"..."; | |
req.HTTPBody = [body dataUsingEncoding:NSUTF8StringEncoding]; | |
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration]; | |
NSURLSessionDataTask *task = [manager dataTaskWithRequest:req completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { | |
}]; | |
[task resume]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment