The iOS framework that grows only as fast as its documentation
Nimbus Interapp

Classes

class  NIInterapp
 An interface for interacting with other apps installed on the device. More...
 

Overview

Nimbus' inter-application communication feature for interacting with other applications installed on the device.

Applications may define schemes that make it possible to open them from your own application using [[UIApplication sharedApplication] openURL:]. There is no way to ask an application which URLs it implements, so Interapp strives to provide a growing set of implementations for known application interfaces.

Minimum Requirements

Required frameworks:

Minimum Operating System: iOS 4.0

Source located in src/interapp/src

When to Use Interapp

Interapp is particularly useful if you would like to reuse functionality provided by other applications. For example, imagine building an app for a client that would optionally support tweeting messages. Instead of building Oath into your application, you can simply check to see whether the Twitter app is installed and then launch it with a pre-populated message. If the app is not installed, Interapp also makes it easy to launch the App Store directly to the page where the app can be downloaded.

Choosing to use Interapp over building functionality into your application is a definite tradeoff. Keeping the user within the context of your application may be worth the extra effort to communicate with the API or implement the functionality yourself. In this case you may find it useful to use Interapp as a quick means of prototyping the eventual functionality.

Examples

Composing a Message in the Twitter App

// Check whether the Twitter app is installed.
if ([NIInterapp twitterIsInstalled]) {
// Opens the Twitter app with the composer prepopulated with the following message.
[NIInterapp twitterWithMessage:@"Playing with the Nimbus Interapp feature!"];
} else {
// Optionally, we can open the App Store to the twitter page to download the app.
[NIInterapp twitter];
}

Opening a Photo in Instagram

NSString* filePath = ...;
NSError* error = nil;
// Copies the image at filePath to a suitable location for being opened by Instagram.
NSURL* fileUrl = [NIInterapp urlForInstagramImageAtFilePath:filePath error:&error];
// It's possible that copying the file might fail (if the image dimensions are
// less than 612x612, for example).
if (nil != fileUrl && nil == error) {
// Note: You must retain docController at some point here. Generally you would retain
// a local copy of docController in your containing controller and then release the
// docController as necessary.
UIDocumentInteractionController* docController =
[UIDocumentInteractionController interactionControllerWithURL:_fileUrl];
// Use the delegate methods to release the doc controller when the menu is dismissed.
docController.delegate = self;
// Use any of the presentOpenIn* methods to present the menu from the correct location.
[docController presentOpenInMenuFromRect: bounds
inView: view
animated: YES];
}