The steps below describe how to configure the NavigationKit iOS SDK with your app. For reference purposes, it may be useful to refer to a fully-built reference application that has these steps completed already. You may use this reference application as a starting point for a new app that uses this SDK. The steps below are appropriate for adding the SDK to an existing app.
Download the NavigationKit.framework file from here, unzip it, then drag it into your project in Xcode. Make sure your app target has specified “NavigationKit.framework” in both the “Embedded Binaries” and “Linked Frameworks and Libraries”.
The NavigationKit.plist file is specific to your app’s NavigationKit setup. It will be provided to you by Radius Networks. Drag it into your project in Xcode.
map_config.json
in your appThe Navigation Kit system will automatically download your map images from a server when
your app starts up. For faster startup and to allow the app to work right away without
internet connectivity, you may bundle these maps and additional configuration in your app. To do this, add your map image files and your map_config.json
(provided by Radius Networks) to your project in Xcode.
RNKManager
to your app delegate.Add a property to your app delegate:
@property (strong, nonatomic) RNKManager *navKitManager;
Initialize the navKitManager
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.navKitManager = [RNKManager managerWithDelegate:self];
[self.navKitManager updateMaps];
return YES;
}
RNKMapView
class into your view.In the view where you want a map to appear, add a generic UIView
object. Set that object’s Custom Class to be RNKMapView
. Create an outlet in your view controller so that your code has access to this mapView
object. Edit your controller’s viewDidLoad
method as follows to set the mapView’s delegate, to connect it to the navKitManager
and to load a map.
- (void)viewDidLoad {
[super viewDidLoad];
self.mapView.delegate = self;
RNKManager *navKitManager = ((AppDelegate *)[[UIApplication sharedApplication] delegate]).navKitManager;
self.mapView.locationManager = navKitManager;
// this loads the first map, but you could load any map
RNKMapConfig *firstMap = navKitManager.maps[0];
[self.mapView loadMap:firstMap];}
In Xcode, build and run your app. In order to see your position on the map, you will need to turn on beacons with the same identifiers configured with your NavigationKit on the server.