Factual would like to announce the updated release of our officially supported SDK for iOS!  This update includes support for the many new API features Factual has to offer. Here are some of the main updates:

  1. New API support:
    • Resolve: starts with incomplete data for an entity, and returns potential entity matches
    • Facets: returns row counts for Factual tables, grouped by facets of data
    • Geopulse: provides point-based access to geographic attributes
    • Reverse Geocode: converts coordinates into addresses
    • Monetize: finds affiliate deals for places in Factual’s Global Places database
    • Match: maps your data to Factual places
    • Submit: submits edits to existing rows, or submits new rows of data to Factual tables
    • Flag: flags problematic rows in Factual tables
  2. Opened up the source code (accessible via the main project on github).
  3. Updated the sample iOS project to use this new SDK and illustrate new features.

Under the hood, we’ve also made following improvements:

  1. Removed dependency on OAConsumer Library.
  2. Switched to Automatic Reference Counting.

Setup

Simply follow the directions on our github page to get the latest version and start using it in your project.

You can also reference the demo project as a working example for incorporating Factual data in your own application, or use it as a starter to immediately begin work on your new application.

Example

Here’s a quick example of how to use the driver. First, create an authenticated handle to Factual:

FactualAPI* _apiObject = [[FactualAPI alloc] initWithAPIKey:@"yourkey" secret:@"yoursecret"];

Next, create the request of your choice, and fetch the results. For example, let’s say you want to find all Apple stores within 1000 meters of the Factual office:

    FactualQuery* queryObject = [FactualQuery query];
    [queryObject addRowFilter:[FactualRowFilter fieldName:@"name"
                                                  equalTo:@"Apple Store"]];
    CLLocationCoordinate2D coordinate = {34.06018, -118.41835};
    [queryObject setGeoFilter:coordinate radiusInMeters:1000];
 
    [_apiObject queryTable:@"places" optionalQueryParams:queryObject withDelegate:myDelegate];

Results from API calls are provided asynchronously via the the passed in delegate. Retrieve and print the results in the delegate implementation:

-(void) requestComplete:(FactualAPIRequest *)request receivedQueryResult:(FactualQueryResult *)queryResult {
     for (id row in queryResult.rows) {
        NSLog(@"Row: %@", row);
     }
}

For more examples on using the SDK with the various Factual APIs, please take a look at the tests in our github project.

We hope you find these improvements useful, and feel free to let us know if you end up using the driver for any new iOS applications, as we’re always excited to see ways that people are using our data.  Let us know if you have any questions or suggestions, and we hope you’ll enjoy using Factual in your mobile applications!

New to Factual?  Explore our data and APIs and sign up to get started.

Best wishes,
Brandon Yoshimoto
Software Engineer