Integrating with your iOS app

The App Embed Component for iOS is a folder that is dragged into your Xcode project. It provides a set of UIViewControllers that host the complete Zappar environment.

Step by Step

1. Unzip the App Embed Component

The App Embed Component download is a zip file that contains:

ZapparEmbed.include. The embed component itself - this is what will be integrated into your app.

ZapparEmbedTest. An example Xcode project that demonstrates the integration.

The first step is to unzip the contents into a folder of your choosing.

2. Copy ZapparEmbed.include into your project directory

Don't worry that the directory is over 400 MB. This is because it contains bitcode – the compiled app will be much smaller!

3. Add ZapparEmbed.include to your project

To do this in Xcode:

  • Right click on your project name in the Project navigator on the left of the screen
  • Select “Add Files to...”
  • Select ZapparEmbed.include
  • Ensure that “Create groups for any added folders” is selected
  • Press “Add”

4. Add API key to Info.plist

Add an entry to the Info.plist file for your project.

Key Type Value
ZapparEmbedKey String your-api-key

Where your-api-key is the key we supplied you for this application. Note that the API key is tied to the bundle identifier of your app (e.g. com.example.myapp). If you change your bundle identifier you will have to request a new API key from us at support@zappar.com.

5. Modify your ViewController to start the Zappar component

Import the following headers into your ViewController header file:

#import <ZapparEmbed/ZapparEmbed.h>
#import "TargetConditionals.h"

Modify your ViewController to adopt the ZapparDelegate protocol, e.g:

@interface ViewController : UIViewController<ZapparDelegate>

Initialize and display the component in your ViewController, e.g:

#if !(TARGET_IPHONE_SIMULATOR)
UIViewController * zappar = [ZapparEmbed viewControllerWithDelegate:self];
[self presentViewController:zappar animated:YES completion:nil];
#endif

This UIViewController is marked for autorelease and should work correctly in ARC projects.

Implement the -(void)zapparClose: method to close the embed component e.g.:

-(void)zapparClose
{
  [self dismissViewControllerAnimated:YES completion:nil];
}

6. Add additional Info.plist entries

Add the following entries to your Info.plist file:

Privacy - Camera Usage Description
A string of your choice, e.g: "To provide augmented reality amazingness."
Privacy - Calendars Usage Description
A string of your choice, e.g: "To save this entry to your calendar."
Privacy - Contacts Usage Description
A string of your choice, e.g: "To save this entry to your contacts."
Privacy - Photo Library Usage Description
A string of your choice, e.g: "To save this snapshot into your camera roll."
Privacy - Photo Library Additions Usage Description
A string of your choice, e.g: "To save this snapshot into your camera roll."
Privacy - Microphone Usage Description
A string of your choice, e.g: "To allow sound to be recorded when using a Video Record function."

These entries are essential to ensure correct behavior of the embed component at runtime.

Suggested Next Steps

With the component successfully launching in your app, you may wish to complete our Regression Test suite to ensure it works correctly in place.

The next article discusses the options for customizing the user interface of the Zappar component:

zapcode branded_zapcode i