To use the library in an iOS application, a few steps must be performed. The first steps differ based on whether or not you’re using Cocoapods. The Cocoapods integration is the easiest, but if you want to add the library yourself to the project that is fine too.
Integration with Cocoapods
Step 1: Update your podfile

If you are using CocoaPodssign up and just add the following line to your Podfile to integrate the library into your IOS application.

Add the following to your podfile:

use_frameworks!
pod 'PlotPlugin'
Step 2: Run pod install

Run

pod install

to let Cocoapods download our library and setup the new project structure.

Continue with Step 3 below.

Integration without Cocoapods
Step 1: Get The Library

Once you log in to our dashboard, download the library under the “Developer Tools” page.

Step 2: Add PlotProjects.framework and other dependencies to your project

Extract the zip file and copy the PlotProjects.framework file to your project.

In the target settings add the following libraries in “Link Binary with libraries” under “Build phases”

  • PlotProjects.framework
  • libsqlite3.tbd
  • CoreLocation.framework
  • MessageUI.framework

You also need to add PlotProjects.framework to Embedded Binaries as well.

Use libsqlite3.dylib for XCode 6 and older

Step 3: Add usage description

Add in “Custom iOS Target Properties” under “Info” the key “NSLocationAlwaysUsageDescription“.

The value must be a message for the user describing why your app uses the location of the device. For example: “Your location is used to instantly inform you when you are near a location that is interesting to you.”

This text is shown when permission to use the location of the device is requested. Note that for the app to be accepted in the App Store, the description why the app needs location services must be clear to the end user.

Step 4: Add configuration file

You can configure Plot through the configuration file. You can find an example config file and your public token on the Developer page on our dashboard.

Add this file as plotconfig.json in the root folder.

{
  "publicToken": "REPLACE_ME",
  "enableOnFirstRun": true
}
Using Swift
Step 5: Add PlotDelegate

Add PlotDelegate to the implemented protocols of your AppDelegate.

@UIApplicationMain
class AppDelegate: UIResponder, 
                   UIApplicationDelegate, 
                   PlotDelegate
Step 6: Implement Appdelegate

In your AppDelegate call PlotDebug.initialize(launchOptions: launchOptions, delegate: self) in func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool

Plot is enabled by default on the first run.

import PlotProjects

@implementation AppDelegate

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  //PlotDebug enables extra debug logging
  //which makes it easier to understand 
  //what is going on
  //
  //Replace PlotDebug with PlotRelease
  //to disable debug logging
  PlotDebug.initialize(launchOptions: launchOptions, delegate: self)
  


  return true
}
...
Step 7: Almost done!

Add PlotBase.handle(notification) to func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) in your AppDelegate.

func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) {

  //Pass the notification to the Plot library to pre process the notification.
  //Don't handle the notifications yourself in this method, because this method isn't always called when a notification is opened.

  PlotBase.handle(notification)
}
Using Objective C
Step 5: Add PlotDelegate

Add PlotDelegate to the implemented protocols of your AppDelegate in the header (.h) file.

@interface AppDelegate : UIResponder
  <UIApplicationDelegate, PlotDelegate>
Step 6: Implement Appdelegate

In the implementation file (.m) of your AppDelegate call [Plot initializeWithLaunchOptions:launchOptions delegate:self] in application:didFinishLaunchingWithOptions:

Plot is enabled by default on the first run.

#import <Plot/Plot.h>

@implementation AppDelegate

-(BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
  //initializes the Plot library:
  [Plot initializeWithLaunchOptions:launchOptions delegate:self];
  
  return YES;
}
…
Step 7: Almost done!

Add [Plot handleNotification:notification] to application:didReceiveLocalNotification: in the implementation file (.m) of your AppDelegate.

-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

  //Pass the notification to the Plot library to pre process the notification.
  //Don't handle the notifications yourself in this method, because this method isn't always called when a notification is opened.

  [Plot handleNotification:notification];
}

Now the Plot Projects library should be ready for use! Create a notification in the dashboard at your current location and launch your app to verify it’s working.