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

Transition from Http.PBinary to Http.HttpBinary

See more HTTP Examples

Provides instructions for replacing deprecated PBinary method calls with HttpBinary.

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/";
NSData byteData;
NSString *contentType = @"application/octet-stream";

//  ------------------------------------------------------------------------
//  The PBinary method is deprecated:

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

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using HttpBinary.
//  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 HttpBinary: verb url: url byteData: byteData contentType: contentType response: responseOut];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}