1#import <Foundation/Foundation.h>
2#import "NCNavigineSdk.h"
3#import "NCLocationManager.h"
4#import "NCNavigationManager.h"
5#import "NCZoneManager.h"
6#import "NCRouteManager.h"
7#import "NCAsyncRouteManager.h"
8#import "NCNotificationManager.h"
9#import "NCMeasurementManager.h"
10#import "NCLocationListManager.h"
11#import "NCLocationWindow.h"
19@property (nonatomic, strong) NCNavigineSdk *
sdk;
34- (void)demonstrateManagersUsage;
39@implementation NavigineSdkExample
60 NSLog(
@"Error: failed to get NavigineSdk instance");
66 NSLog(
@"Navigine SDK Version: %@", [NCNavigineSdk getVersion]);
71 NSLog(
@"Device ID: %@", [NCNavigineSdk getDeviceId]);
76 NSLog(
@"Relative Time: %lld", [NCNavigineSdk getRelativeTime]);
81 [
self.sdk setUserHash:@"XXXX-XXXX-XXXX-XXXX"];
86 [
self.sdk setServer:@"https://custom.navigine.com"];
92 }
@catch (NSException *exception) {
93 NSLog(
@"SDK initialization error: %@", exception.reason);
103 self.locationManager = [
self.sdk getLocationManager];
105 NSLog(
@"LocationManager successfully initialized");
112 self.navigationManager = [
self.sdk getNavigationManager:
self.locationManager];
114 NSLog(
@"NavigationManager successfully initialized");
122 self.zoneManager = [
self.sdk getZoneManager:
self.navigationManager];
124 NSLog(
@"ZoneManager successfully initialized");
132 self.routeManager = [
self.sdk getRouteManager:
self.locationManager
133 navigationManager:
self.navigationManager];
135 NSLog(
@"RouteManager successfully initialized");
143 self.asyncRouteManager = [
self.sdk getAsyncRouteManager:
self.locationManager
144 navigationManager:
self.navigationManager];
146 NSLog(
@"AsyncRouteManager successfully initialized");
154 self.notificationManager = [
self.sdk getNotificationManager:
self.locationManager];
156 NSLog(
@"NotificationManager successfully initialized");
164 self.measurementManager = [
self.sdk getMeasurementManager:
self.locationManager];
166 NSLog(
@"MeasurementManager successfully initialized");
173 self.locationListManager = [
self.sdk getLocationListManager];
175 NSLog(
@"LocationListManager successfully initialized");
181 self.storageManager = [
self.sdk getStorageManager];
183 NSLog(
@"StorageManager successfully initialized");
191 - (void)printSdkInfo {
192 NSLog(
@"=== Navigine SDK Information ===");
193 NSLog(
@"SDK Version: %@", [NCNavigineSdk getVersion]);
194 NSLog(
@"Device ID: %@", [NCNavigineSdk getDeviceId]);
195 NSLog(
@"Relative Time: %lld", [NCNavigineSdk getRelativeTime]);
196 NSLog(
@"LocationManager: %@",
self.
locationManager ?
@"available" :
@"unavailable");
197 NSLog(
@"NavigationManager: %@",
self.
navigationManager ?
@"available" :
@"unavailable");
198 NSLog(
@"ZoneManager: %@",
self.
zoneManager ?
@"available" :
@"unavailable");
199 NSLog(
@"RouteManager: %@",
self.
routeManager ?
@"available" :
@"unavailable");
200 NSLog(
@"AsyncRouteManager: %@",
self.
asyncRouteManager ?
@"available" :
@"unavailable");
201 NSLog(
@"NotificationManager: %@",
self.
notificationManager ?
@"available" :
@"unavailable");
202 NSLog(
@"MeasurementManager: %@",
self.
measurementManager ?
@"available" :
@"unavailable");
203 NSLog(
@"LocationListManager: %@",
self.
locationListManager ?
@"available" :
@"unavailable");
204 NSLog(
@"StorageManager: %@",
self.
storageManager ?
@"available" :
@"unavailable");
210 - (void)demonstrateManagersUsage {
211 NSLog(
@"=== Manager Usage Demonstration ===");
215 NSLog(
@"LocationManager ready for location operations");
221 NSLog(
@"NavigationManager ready for positioning");
227 NSLog(
@"ZoneManager ready for zone operations");
233 NSLog(
@"RouteManager ready for route building");
239 NSLog(
@"AsyncRouteManager ready for async route operations");
245 NSLog(
@"NotificationManager ready for notifications");
251 NSLog(
@"MeasurementManager ready for measurements");
257 NSLog(
@"LocationListManager ready for location list operations");
263 NSLog(
@"StorageManager ready for storage operations");
271 - (void)demonstrateObjectiveCFeatures {
272 NSLog(
@"=== Objective-C Features Demonstration ===");
275 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
277 dispatch_async(dispatch_get_main_queue(), ^{
278 NSLog(
@"Async operation completed");
283 [
self addObserver:
self forKeyPath:@"locationManager" options:NSKeyValueObservingOptionNew context:nil];
289 SEL selector =
@selector(printSdkInfo);
290 if ([
self respondsToSelector:selector]) {
291 [
self performSelector:selector];
298 - (void)observeValueForKeyPath:(NSString *)keyPath
300 change:(NSDictionary<NSKeyValueChangeKey,
id> *)change
301 context:(
void *)context {
302 if ([keyPath isEqualToString:
@"locationManager"]) {
303 NSLog(
@"LocationManager changed");
312 [
self demonstrateManagersUsage];
313 [
self demonstrateObjectiveCFeatures];
317 [
self removeObserver:
self forKeyPath:@"locationManager"];
325int main(
int argc,
const char * argv[]) {
328 [example runExample];