Observation Graph SDK for iOS

The steps below will guide you through installing the Observation Graph SDK into your app via Xcode and Objective-C.


Requirements

  • The Observation Graph SDK is compatible with iOS 8.0+
  • After compilation, the SDK should add no more than 1.7 MB to your app’s size.
  • The SDK requires either ALWAYS or IN APP location authorizations.


Get an API key

Your Factual account representative will provide you with an API key.


Copy the SDK to Your Project

  • Decompress the downloaded archive. The contents should contain the files FactualObservationGraph.h and libFactualObservationGraph.a.
  • Within Xcode, add both files to your project (libFactualObservationGraph.a may fail to link otherwise!). Make sure to enable the “Copy items if needed” checkbox for Destination (visible under ‘Options’).


  • Note that you can optionally drag and drop the library files into your project. Similiar to the above process, make sure to enable the “Copy items if needed” checkbox for Destination (visible under ‘Options’).



Add Linked Libraries

Click on the Build Phases tab. Link the following binary libraries:

  • libFactualObservationGraph.a (This should already be linked from step 3.)
  • libc++.tbd
  • libz.tbd



Disable Bitcode

The Observation Graph SDK is not compatible with bitcode.


Set Location Authorization Messaging

You must ensure the InfoPlist.strings values associated with location authorizations are defined for:

  • NSLocationAlwaysUsageDescription
  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysAndWhenInUseUsageDescription

If you haven’t done so already, the process is as follows:

  • From the Project Navigator in Xcode, open info.plist.
  • Hover over Information Property List. Click on the small plus symbol (+) in a circle.
  • In the resulting pick list menu, scroll down and select the item “Privacy - Location When In Use Usage Description”
  • Double click on the corresponding Value field and enter your desired prompt text.
  • Repeat for the property “Privacy - Location Always Usage Description”.
  • Repeat for the property “Privacy - Location Always and When In Use Usage Description”.

These values define the messages that will be displayed to your users when prompting for the appropriate location authorizations.


Example Implementation Code

  • Import the ObservationGraphSDK header
  • Add the FactualObservationGraphDelegate interface

Implementation

The following example:

  • Requests necessary location authorization
  • Starts the SDK
  • Implements the FactualObservationGraphDelegate interface


Insert your API Key

In the code example above, you’ll need to provide your API key.

[FactualObservationGraph startWithApiKey:@"your Api Key Goes Here"
                                delegate:self];