Sample code for 30+ languages & platforms
Objective-C Requires Chilkat v11.0.0+

Transition from Http.PFile to Http.HttpFile

Provides instructions for replacing deprecated PFile method calls with HttpFile.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoHttpResponse.h>

BOOL success = NO;

CkoHttp *http = [[CkoHttp alloc] init];

NSString *verb = @"POST";
NSString *url = @"https://example.com/";
NSString *localFilePath = @"c:/temp/requestBodyContent.dat";
NSString *contentType = @"application/octet-stream";

//  ------------------------------------------------------------------------
//  The PFile method is deprecated:

CkoHttpResponse *responseObj = [http PFile: verb url: url localFilePath: localFilePath contentType: contentType md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using HttpFile.
//  Your application creates a new, empty HttpResponse object which is passed 
//  in the last argument and filled upon success.

CkoHttpResponse *responseOut = [[CkoHttpResponse alloc] init];
success = [http HttpFile: verb url: url localFilePath: localFilePath contentType: contentType response: responseOut];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}