Getting Started

PavelTychinin edited this page Sep 10, 2018 · 10 revisions

To start using Navigation library in your project you should do the following steps.

The full Navigine Example project (with sources) can be downloaded here.

Step 1

Register on https://client.navigine.com/, create a location and get your personal security key in the profile (it has the form 16 hexadecimal digits: XXXX-XXXX-XXXX-XXXX).

Step 2
Installation using framework

Download Navigine.framework and add it to the iOS project.

Installation using Cocoapods
pod 'Navigine', '~> 1.0'
Step 3.0
  • Add to your Info.plist file string NSBluetoothPeripheralUsageDescription with description.
<key>NSBluetoothPeripheralUsageDescription</key>
<string>The application needs Bluetooth access</string>
Step 3.1
  • If iOS version less than 11.0 add to your Info.plist file string NSLocationAlwaysUsageDescription with description.
<key>NSLocationAlwaysUsageDescription</key>
<string>The application uses background location services to send a local notification</string>
Step 3.2
  • If iOS version greater than 11.0 add to your Info.plist file both of NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription strings with description.
<key>NSLocationWhenInUseUsageDescription</key>
<string>The application uses background location services to send a local notification</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>The application uses background location services to make navigation</string>
Step 4

Initialize Navigation library inside AppDelegate method application:didFinishLaunchingWithOptions:. Use NavigineCore class.

Step 4.0

If you want to use SDK with default server you should set personal userHash.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
  NSString *userHash = @"0000-0000-0000-0000"; // your personal security key in the profile
  NavigineCore *navigineCore = [[NavigineCore alloc] initWithUserHash:userHash];
  return YES;
}
Step 4.1

If you want to use SDK with your server you should initialize SDK with personal userHash and server

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
  NSString *userHash = @"0000-0000-0000-0000";// your personal security key in the profile
  NSString *server = @"https://api.navigine.com"; // your API server
  NavigineCore *navigineCore = [[NavigineCore alloc] initWithUserHash:userHash
                                                               server:server];
  return YES;
}
Step 5

Download location with respect to your server and userHash.

Using location id

NSInteger locationId = 1; // location id from web site
BOOL forced = YES; 
// If YES, the content data would be loaded even if the same version has been downloaded already earlier.
// If NO, the download process compares the current downloaded version with the last version on the server.
// If server version equals to the current downloaded version, the re-downloading is not done.

[navigineCore downloadLocationById:locationId
                       forceReload:forced
                      processBlock:^(NSInteger loadProcess) {
                          NSLog(@"%zd",loadProcess);
                      } successBlock:^(NSDictionary *userInfo) {
                          [navigineCore startNavigine];
                      } failBlock:^(NSError *error) {
                          NSLog(@"%@",error);
                      }];

or using location name

NSString *locationName = @"navigine"; // location name from web site
BOOL forced = YES; 
// If YES, the content data would be loaded even if the same version has been downloaded already earlier.
// If NO, the download process compares the current downloaded version with the last version on the server.
// If server version equals to the current downloaded version, the re-downloading is not done.
[navigineCore downloadLocationByName:locationName
                         forceReload:forced
                        processBlock:^(NSInteger loadProcess) {
                            NSLog(@"%zd",loadProcess);
                        } successBlock:^(NSDictionary *userInfo) {
                            [navigineCore startNavigine];
                        } failBlock:^(NSError *error) {
                            NSLog(@"%@",error);
                        }];
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.