SITLocationManager
Objective-C
@interface SITLocationManager : NSObject <SITLocationInterface>
Swift
class SITLocationManager : NSObject, SITLocationInterface
SITLocationManager The SITLocationManager class is the central point for configuring the delivery of location- and headind related events to your app. You use the shared instance of this class to establish the parameters that determine when location and heading events should be delivered and to start and stop the actual delivery of those events.
Set the desired delegates to listen for location updates.
Note
This class needs bluetooth information to do its work. In case bluetooth access is off, or permissions are denied, an error will be returned to the delegate. It can be thrown at the initial checking or at any moment during the positioning.-
Singleton instance
Note
You should always use this method to obtain the manager object and should not try to create instances directlyDeclaration
Objective-C
+ (instancetype _Nonnull)sharedInstance;
Swift
class func sharedInstance() -> Self
Return Value
An initialized object
-
Deprecated
Use
-[SITLocationManager addDelegate:]
and-[SITLocationManager removeDelegate:]
insteadObject that conforms to the SITLocationDelegate Protocol
Declaration
Objective-C
@property (nonatomic, weak) id<SITLocationDelegate> _Nullable delegate;
Swift
weak var delegate: SITLocationDelegate? { get set }
-
Deprecated
Use
-[SITLocationManager addGeofenceDelegate:]
and-[SITLocationManager removeGeofenceDelegate:]
insteadObject that conforms to the SITGeofencesDelegate Protocol where notifications about the user entering or exiting a geofence are notified
Declaration
Objective-C
@property (nonatomic, weak) id<SITGeofencesDelegate> _Nullable geofenceDelegate;
Swift
weak var geofenceDelegate: SITGeofencesDelegate? { get set }
-
Add delegate to listen for location updates.
Note
you can call-[SITLocationManager removeDelegate:]
if you wish to stop receiving notifications in that specific delegate. If the delegate is going to be released from memory you must call-[SITLocationManager removeDelegate:]
as well to avoid SitumSDK to retain the delegate in memoryDeclaration
Objective-C
- (void)addDelegate:(id<SITLocationDelegate> _Nonnull)delegate;
Swift
func addDelegate(_ delegate: SITLocationDelegate)
-
Remove delegate to listen for location updates.
Declaration
Objective-C
- (void)removeDelegate:(id<SITLocationDelegate> _Nonnull)delegate;
Swift
func removeDelegate(_ delegate: SITLocationDelegate)
-
Add a
SITGeofenceDelegate
to be notified when the user enters or exits geofences.Note
This method starts calculating entrances and exits for all geofences in your building based on each user’s location. This can introduce significant computational overhead, particularly in buildings with many geofences. To avoid unnecessary costs, ensure you are removing the delegate and stopping geofence processing when it is no longer needed.
Note
Delegates will only receive notifications for geofence entries and exits that occur after they are added. Any entry or exit events that happened prior to the delegate’s registration will not trigger notifications.
Declaration
Objective-C
- (void)addGeofenceDelegate:(id<SITGeofencesDelegate> _Nonnull)delegate;
Swift
func addGeofenceDelegate(_ delegate: SITGeofencesDelegate)
Parameters
geofenceDelegate
the
SITGeofenceDelegate
to receive notifications. -
Remove a certain
SITGeofenceDelegate
. To stop processing geofence events when is not needed, callSITLocationManager -removeAllGeofenceDelegates
.Declaration
Objective-C
- (void)removeGeofenceDelegate:(id<SITGeofencesDelegate> _Nonnull)delegate;
Swift
func removeGeofenceDelegate(_ delegate: SITGeofencesDelegate)
Parameters
geofenceListener
The
SITGeofenceDelegate
} to be removed. -
Remove all
SITGeofenceDelegate
and stop processing events related to geofences with every user location.Declaration
Objective-C
- (void)removeAllGeofenceDelegates;
Swift
func removeAllGeofenceDelegates()