Geofence iOS Quick Start

Get Gimbal up and running in your iOS App.

Setup Gimbal Application

Important This guide assumes you have a iOS project setup with Gimbal. Please folllow Gimbal Quick Start guide if you have not yet setup an iOS project with Gimbal.

Gimbal iOS Quickstart »

Add Geofencing

The following steps will allow you to use Gimbal Geofencing features in your application.

Create a Geofence

Create a geofence for your current location so you will see a place event trigger when your application starts.

Note Make sure the geofence you create is at your current location if you want it to trigger when your app launches.

Create Geofence »

Getting Geofence Events from the Place Connector

Add the QLContextPlaceConnector Property

To receive geofence events you must add the <QLContextPlaceConnectorDelegate> protocol to your AppDelegate.h and add a QLContextPlaceConnector property.


    #import <ContextLocation/QLContextPlaceConnector.h>

    @interface AppDelegate : UIResponder <UIApplicationDelegate, QLContextPlaceConnectorDelegate>
    ...
    @property (nonatomic) QLContextPlaceConnector *placeConnector;
    ...
        

Add the QLContextPlaceConnectorDelegate Method

Add the didGetPlaceEvent: method to your AppDelegate.m class. This method is called when a geofence event is detected.


    #import <ContextLocation/QLPlaceEvent.h>
    #import <ContextLocation/QLPlace.h>
    ...
    - (void)didGetPlaceEvent:(QLPlaceEvent *)placeEvent
    {
        NSLog(@"did get place event %@", [placeEvent place].name);
    }
        

Set Your AppDelegate as the QLContextPlaceConnectorDelegate

To receive the geofence events you must set your AppDelegate as the delegate on the QLContextPlaceConnectorDelegate. Do this in your application: didFinishLaunchingWithOptions: method (after the Core Connector is enabled).


    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        ...
        self.placeConnector = [[QLContextPlaceConnector alloc] init];
        self.placeConnector.delegate = self;
        ...
        

Geofence Success

Note When you launch the application you will have to accept the Gimbal Terms of Service.

Once Gimbal detects you are in the geofence you created in the Gimbal Manager you will see a log entry that looks like this.


    2013-03-28 11:17:58.947 myproduct[11532:907] did get place event My Place
                

Learn More

For additional details on how to leverage the SDK functionality, refer to the sample applications and documentation included in the zip file provided.

Gimbal iOS Guide »