Sample code for 30+ languages & platforms
Objective-C

Transition from Http.GetHead to Http.HttpNoBody

Provides instructions for replacing deprecated GetHead method calls with HttpNoBody.

Chilkat Objective-C Downloads

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

BOOL success = NO;

CkoHttp *http = [[CkoHttp alloc] init];
NSString *url = @"https://www.example.com/";

// ------------------------------------------------------------------------
// The GetHead method is deprecated:

CkoHttpResponse *resp1 = [http GetHead: url];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%d",[resp1.StatusCode intValue]);

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

CkoHttpResponse *resp2 = [[CkoHttpResponse alloc] init];
success = [http HttpNoBody: @"HEAD" url: url response: resp2];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%d",[resp2.StatusCode intValue]);