How to install & configure Sparksee mobile for iOS (C++)

apple logo-01Sparksee is the first graph database available for iOS devices applications, available, right now, in the C++ interface. In this article we will guide through a typical installation & configuration , so you can start working with Sparksee in your mobile development environment in a few minutes.

 

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. This directory contains the include files, the static library and the documentation.

Step 2) Creating a new project linking Sparksee mobile library

  • Add the Sparksee include files to the search path in your application project. The path to Sparksee.framework/Resources/sparksee/ must be added as non-recursive to the User Header Search Paths option on the build settings of your Xcode application project. This is required because Sparksee’s include files use a hierarchy of directories not usual in an Xcode framework. Therefore, they can’t be included in the regular Headers directory of the framework.
  • Add the Sparksee.framework to the Link Binary With Libraries build phase of your application project. You can just drag it there.
  • 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.
  • 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

Remember that all the source files using C++ should have the extension “.mm” instead of “.m”.

Step 4) Initial steps

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

  • Add the following namespace: using namespace sparksee::gdb;
  • Now you should make some configuration steps before creating the database. First of all, create a new configuration class with SparkseeConfig cfg;
  • Set the license code with SparkseeConfig::SetLicense(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 SparkseeConfig::SetCacheMaxSize(MB): Sparksee by default takes all the free available memory space, but that is something you surely may control in a phone device.
  • Activate the recovery functionality with SparkseeConfig::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 SparkseeConfig::SetLogFile(filename): Specify a log full name&path where you have write permission.
  • Create the main Sparksee class with new Sparksee(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 Sparksee::Create(filename, alias). Again you will need name&path as happens with the log.
  • It’s time to create a new session with Database::NewSession().
  • Graph objects and operations are available at Graph class level; you need to get the graph from the session with Session::GetGraph().

Done!

We continue improving our Sparksee mobile iOS support by having an Objective-C API on the works to be released soon, so keep tuned!

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

Comments are closed.