Apple Legacy

Capture screenshots in Objective-C

Add screenshot and scrolling GIF capabilities to your Objective-C applications with NSURLSession. Native Apple APIs, no WebKit complexity.

Installation

  1. 1NSURLSession is included in Foundation framework
  2. 2Get your API key from the dashboard
  3. 3Set the X-KEY header in your NSMutableURLRequest

Authentication

Include your API key in the X-KEY header with every request:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"your-api-key" forHTTPHeaderField:@"X-KEY"];

NSURLSessionDataTask *task = [[NSURLSession sharedSession]
    dataTaskWithRequest:request
    completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        // Handle response
    }];

Objective-C Screenshot Example

Capture a screenshot or create a scrolling GIF animation with a simple GET request:

Screenshot
NSURL *url = [NSURL URLWithString:
    @"https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"your-api-key" forHTTPHeaderField:@"X-KEY"];

NSURLSession *session = [NSURLSession sharedSession];
[[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    [data writeToFile:@"screenshot.png" atomically:YES];
}] resume];
Animation
NSURL *url = [NSURL URLWithString:
    @"https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"your-api-key" forHTTPHeaderField:@"X-KEY"];

NSURLSession *session = [NSURLSession sharedSession];
[[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    [data writeToFile:@"animation.gif" atomically:YES];
}] resume];

Response Format

On success, the API returns the image binary data directly in the response body.

Status Code200 OK
Content-Typeimage/png, image/jpeg, or image/gif
BodyBinary image data (NSData)
Error ResponseError message with 4xx/5xx status

Key Features

Zero Setup

NSURLSession is built into Foundation. No additional frameworks or browser installations required.

Production Ready

Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.

Objective-C Integration

Native Foundation APIs. Works with iOS, macOS, tvOS apps, or mixed Swift/Objective-C projects.

Rich Features

Custom viewport sizes, full page capture, PNG/JPEG formats, scrolling GIFs with 15 easing functions.

Frequently Asked Questions

Do I need to install any browser dependencies?

No. Scrnpix runs browsers on our infrastructure. You only need Foundation's NSURLSession.

Can I use this with iOS or macOS apps?

Yes. Scrnpix works with any Apple platform — iOS, macOS, tvOS, or watchOS with network access.

How do I handle errors in Objective-C?

Check the NSError in the completion handler. A 200 status code means success with image data in NSData.

What iOS/macOS version is required?

iOS 7+ or macOS 10.9+ with NSURLSession support. The API is a simple HTTP GET request.

Ready to capture screenshots in Objective-C?

Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.

Start Free