Send/Receive Infrared signals via IRKit device
Objective-C Other
Clone or download
Latest commit fd49c23 Dec 1, 2016


IRKit device and SDK(this library) lets you control your home electronics from your iOS devices. IRKit device has a Infrared LED and receiver, and a WiFi module inside. Any device with internet or local wifi connection can use IRKit devices to make it send IR signals.

This library does:

  • provide UIViewController subclasses that wraps complex procedures to connect and learn IR signals from IRKit devices
  • provide a simple interface to send IR signals

Get IRKit Device

see IRKit device


Use cocoapods 1.0.0 or higher

$ cat Podfile
source ''

platform :ios, '8.0'
workspace 'MyApp.xcworkspace'
project 'MyApp/MyApp.xcodeproj'

pod 'IRKit', '~> 3.0'

target 'MyApp' do
  project 'MyApp/MyApp.xcodeproj'

$ pod install


See Minimal app for a working minimal IR remote controller application.

Include header

#import <IRKit/IRKit.h>


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    [IRKit startWithAPIKey:@"#{ fill in your apikey }"];
    return YES;

Get API key

% curl -d "email={your email}" ""
{"message":"You will receive an email shortly, please click the URL in it to get an apikey"}

and open the URL in the email.

Sending IR signals

IR signal is represented as a IRSignal instance.

[signal sendWithCompletion:^(NSError *error) {
    NSLog(@"sent error: %@", error);

How to get an IRSignal?

You get your first IRSignal by learning it, which means: you point your old infrared remote controller at IRKit device's IR receiver, and press it's button. IRKit device will send it over to your app(with IRKit iOS SDK).

But first, you need to pair with an IRKit device.

// in your main view controller
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    // find IRKit if none is known
    if ([IRKit sharedInstance].countOfReadyPeripherals == 0) {
        IRNewPeripheralViewController *vc = [[IRNewPeripheralViewController alloc] init];
        vc.delegate = self;
        [self presentViewController:vc

#pragma mark - IRNewPeripheralViewControllerDelegate

- (void)newPeripheralViewController:(IRNewPeripheralViewController *)viewController
            didFinishWithPeripheral:(IRPeripheral *)peripheral {
    NSLog( @"peripheral: %@", peripheral );

    [self dismissViewControllerAnimated:YES

When pairing is done, you're ready to learn an IRSignal from it.

IRNewSignalViewController *vc = [[IRNewSignalViewController alloc] init];
vc.delegate = self;
[self presentViewController:vc

#pragma mark - IRNewSignalViewControllerDelegate

- (void)newSignalViewController:(IRNewSignalViewController *)viewController
            didFinishWithSignal:(IRSignal *)signal {
    NSLog( @"signal: %@", signal );

    if (signal) {
        // successfully learned!
        _signal = signal;
    [self dismissViewControllerAnimated:YES

Collection of multiple IRSignals

Most remote controllers have more than 1 button, so you'll want to manage a collection of IRSignals. IRSignals (with a s postfix) is it.

_signals = [[IRSignals alloc] init];

// and add a signal to the collection
[_signals addSignalsObject:_signal];

// send multiple IRSignal-s sequentially
[_signals sendSequentiallyWithCompletion:^(NSError *error) {
    NSLog( @"sent with error: %@", error );

// and save it in NSUserDefaults
[_signals saveToStandardUserDefaultsWithKey:@"irkit.signals"];

// or load it from NSUserDefaults
[_signals loadFromStandardUserDefaultsKey:@"irkit.signals"];

// or send it elsewhere
NSData *data = [_signals data];

// or as JSON
NSString *json = [_signals JSONRepresentation];

App Transport Security

IRKit's Device HTTP API doesn't support HTTPS.
Add following lines in your Info.plist.