Loading...
Searching...
No Matches
<NCLocationListener> Protocol Reference

Class provides a callback to be invoked when LocationManager class downloads the location from server or load it from the storage. More...

#include <com/navigine/idl/objc/NCLocationListener.h>

+ Inheritance diagram for <NCLocationListener>:

Instance Methods

(void) - onLocationLoaded:
 Called when new location version has been downloaded from server or load it from the storage.
 
(void) - onLocationFailed:error:
 Called if unable to download location version from CMS.
 

Detailed Description

Class provides a callback to be invoked when LocationManager class downloads the location from server or load it from the storage.

Referenced from LocationManager.

Note
The callback is invoked in the UI thread.

Definition at line 20 of file NCLocationListener.h.

Method Documentation

◆ onLocationFailed:error:

- (void) onLocationFailed: (int32_t) locationId
error: (nullable NSError *) error 

Called if unable to download location version from CMS.

Parameters
locationIdlocation unique identifier in SMC.
errorhandled error.

Swift code snippet:

func onLocationFailed(_ locationId: Int32, error: Error?) {
print("Failed to load location \‍(locationId): \‍(error?.localizedDescription ?? "Unknown error")")
}

Objective C code snippet:

- (void)onLocationFailed:(int32_t)locationId error:(NSError *)error {
NSLog(@"Failed to load location %d: %@", locationId, error.localizedDescription);
}

◆ onLocationLoaded:

- (void) onLocationLoaded: (nullable NCLocation *) location

Called when new location version has been downloaded from server or load it from the storage.

Parameters
locationLocation instance or nil if server url or USER_HASH was changed.

Swift code snippet:

func onLocationLoaded(_ location: NCLocation?) {
print("Location loaded successfully")
currentLocation = location
if let location = location {
demonstrateLocationUsage(location)
}
}

Objective C code snippet:

- (void)onLocationLoaded:(NCLocation *)location {
NSLog(@"Location loaded successfully");
self.currentLocation = location;
if (location != nil) {
[self demonstrateLocationUsage:location];
}
}

The documentation for this protocol was generated from the following file: