NSString *url = @"url"
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
//text 🈶️中文记得charset=utf-8
[request setValue:@"application/text; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
request.HTTPMethod = @"POST"
NSData *data =[@"text" dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable connectionError) {
}
}];
[task resume];
网友评论