How to install & configure Sparksee iOS (Objective-C)

apple logo-01Sparksee is the first graph database available for iOS devices applications, available since 5.1 in both an Objective-C and C++ interfaces. In this article we will guide through a typical installation & configuration for the Objective-C, so you can start working with Sparksee in your mobile development environment in a few minutes. You can take a look at our C++ tutorial published here as well.

 

Step 1) Downloading Sparksee

Download your Sparksee mobile library from our website here: http://www.sparsity-technologies.com/#download

We will send you an email on how to download your own copy. Downloads for mobile (like the licenses requests) are moderated, please wait until a support member contacts back.

Once you receive your download, uncompress the “.dmg” file to get the Sparksee.framework directory. The documentation will be available in the framework Resources/Documentation.

Step 2) Creating a new project linking Sparksee mobile library

  • Add the Sparksee.framework to the Link Binary With Libraries build phase of your application project. You can just drag it there.
  • Now, this step changes whether you are using C++ in your project or not:
    • For developers not using C++, you must explicitly add the right C++ standard library because the Sparksee library core depends on it. Click on the “+” sign of the same “Link Binary With Libraries” build phase of your application project, then select the appropiate C++ library (“libc++.dylib” for LLVM C++11 version or “libstdc++.6.dylib” for the GNU C++ version) and finally click the “Add” button.
    • For developers already using C++ in their project, choose the most appropriate library: libstdc++ (GNU C++ standard library) or libc++ (LLVM C++ standard library with C++11 support) in the C++ Standard Library option from the build settings of the compiler. This version must match the one you downloaded in first place.
  • Now import the header in your source code by adding:
    #import <Sparksee/Sparksee.h>
  • Take into account that after all these changes you may need to Clean your Project.

Run the empty application! That’s it! You now have a new project using Sparksee.

 Step 3) Other configuration considerations

Setting an explicit memory limit to the Sparksee cache is highly recommended. For more information about Sparksee configuration variables check the Configuration chapter in the User Manual.

Step 4) Initial steps

Now you should create a new Sparksee database,  follow this order of actions:

  • You should make some configuration steps before creating the database. First of all, create a new configuration class with STSSparkseeConfig *cfg = [[STSSparkseeConfig alloc] init];
  • Set the license code with [cfg setLicense: @”THE_LICENSE_KEY”]; Sparksee mobile only works with a valid key, you are going to get that code in the same email of your download.
  • Limit the Sparksee cache memory with [cfg setCacheMaxSize: smallsizeinMB]: Sparksee by default takes all the free available memory space, but that is something you surely may control in a mobile device.
  • Activate the recovery functionality with [cfg setRecoveryEnabled: TRUE]: The recovery is a helpful functionality that will allow you to recover all your data if any error occurs.
  • Set the log file with [cfg setLogFile: pathtothelogfile]: Specify a log full name&path where you have write permission.
  • Create the main Sparksee class with  STSSparksee *sparksee =[[STSSparksee alloc] initWithConfig: cfg]: take into account that the argument of this method is the SparkseeConfig created.
  • You have already configured Sparksee, now let’s create your database with STSDatabase *db = [sparksee create: pathtothedbfile alias: @”nameofthedatabase”].
  • It’s time to create a new session with STSSession *sess = [db createSession].
  • Graph objects and operations are available at Graph class level; you need to get the graph from the session with STSGraph *g = [sess getGraph].

Done!

This entry was posted in Documentation, Sparksee, Sparksee mobile and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *