Runscope API Testing and Monitoring    Learn More →

Hung Truong's RunscopeURLRequest Project Brings Easy API Debugging to iOS

By John Sheehan on .

hungcat.jpeg

It's near impossible to build an iOS app without using a web service API to send data back and forth between the app and your (or someone else's) servers. We hear from many of our customers that when trouble arises with these integrations debugging is cumbersome and slow. Hung Truong built Runscope-iOS to make solving those types of problems with Runscope even easier.

Hung is an Ann Arbor-based developer working for a creative/design/engineering firm called NewFoundry. He spends most of his free time working on iOS apps and has a particular fondness for APIs. Hung's web site features his creations and his blog catalogs his experiences building apps.

RunscopeURLRequest

The GitHub project page describes Runscope-iOS as "a subclass of NSMutableURLRequest that automagically changes your API requests to Runscope requests. " We couldn't have put it better ourselves. Here's how you use it.

If you don't have a free Runscope account, sign up for one before getting started.

Download the RunscopeURLRequest.h and RunscopeURLRequest.m files from the GitHub project and copy them into your Xcode project. Import the header like so:

#import "RunscopeURLRequest.h"

Use as you would a normal NSMutableURLRequest or NSURLRequest, including your Runscope bucket key:

request = [RunscopeURLRequest requestWithURL:url bucket:runscopeBucketKey];

RunscopeURLRequest also automatically handles ports, adding the necessary Runscope-Request-Port header if needed. It also supports authenticated buckets (see the readme for an example).

That's it! The Runscope URL for the request will be automatically generated and you'll see any requests made show up in the stream for the specified bucket.

We've added Runscope-iOS to our list of Community Code, joining runscope-rb, and RunscopeMessageHandler for .NET's HttpClient along with our Python Requests adapter. Thanks for the great library Hung!

 

Categories: community, code samples, debugging

Everything is going to be 200 OK®