Sample code for 30+ languages & platforms
Objective-C

Example: Http.QuickGetStr method

Demonstrates the QuickGetStr method.

Chilkat Objective-C Downloads

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

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

//  Keep the response body if there's an error.
http.KeepResponseBody = YES;

//  Send the HTTP GET and return the content in a string.
NSString *str = [http QuickGetStr: @"https://www.chilkatsoft.com/helloWorld.json"];
if (http.LastMethodSuccess == NO) {
    if ([http.LastStatus intValue] == 0) {
        //  Communications error.  We did not get a response.
        NSLog(@"%@",http.LastErrorText);
    }
    else {
        NSLog(@"%@%d",@"Response status code: ",[http.LastStatus intValue]);
        NSLog(@"%@",@"Response body error text:");
        NSLog(@"%@",http.LastResponseBody);
    }

    return;
}

NSLog(@"%@",str);
NSLog(@"%@",@"Success");