CLASS
IPSCore
public class IPSCore: NSObject
This class represents the Indoor Positioning System (IPS) Core Client. It is the element which exposes the functionality which is common to all IPS services.
Properties
loginDelegate
@objc public static var loginDelegate: IPSLoginDelegate?
This delegate is used to receive the result of a login request.
See IPSCore.login(apiKey:)
logoutDelegate
@objc public static var logoutDelegate: IPSLogoutDelegate?
This delegate is used to receive the result of a logout request.
See IPSCore.logout()
userSessionId
@objc public static var userSessionId: String?
The ID of the current active user session. Nil if there is no active session.
- Since: 8.0.0
Methods
addConnectionStateObserver(_:)
@objc public static func addConnectionStateObserver(_ observer: IPSConnectionStateObserver)
This method is used to add observer to receive indications about the state of connectivity to the IPS service.
-
Since: 2.10.0
-
Parameters:
- observer: an object implementing
IPSConnectionStateObserverprotocol
removeConnectionStateObserver(_:)
@objc public static func removeConnectionStateObserver(_ observer: IPSConnectionStateObserver)
This method is used to remove observer and stop receiving indications about the state of connectivity to the IPS service.
-
Since: 2.10.0
-
Parameters:
- observer: an object implementing
IPSConnectionStateObserverprotocol
Parameters
| Name | Description |
|---|---|
| observer | an object implementing IPSConnectionStateObserver protocol |
login(apiKey:ipsDomain:userID:completion:)
@objc public static func login(apiKey: String, ipsDomain: String? = nil, userID: String? = nil, completion: ((IPSError?) -> ())? = nil)
This method performs the login operation. A login is required to perform any IPS operation
and must be the first call after launching an application (or after IPSCore.logout()). Interaction with the IPS mechanism
will be possible only after successful login.
-
Since: 2.10.0
-
Parameters:
- apiKey: Your user API key as provided by Oriient.
- ipsDomain: Your IPS domain as provided by Oriient.
- userID: An optional unique identifier which (non-personally identifiable) represents each signed-in user to enable analysis of sessions across devices. This ID is most often provided by an authentication system.
Parameters
| Name | Description |
|---|---|
| apiKey | Your user API key as provided by Oriient. |
| ipsDomain | Your IPS domain as provided by Oriient. |
| userID | An optional unique identifier which (non-personally identifiable) represents each signed-in user to enable analysis of sessions across devices. This ID is most often provided by an authentication system. |
login(accessToken:accessTokenExpirationMillis:refreshToken:refreshTokenExpirationMillis:ipsDomain:userID:completion:)
@objc public static func login(
accessToken: String,
accessTokenExpirationMillis: Double,
refreshToken: String,
refreshTokenExpirationMillis: Double,
ipsDomain: String? = nil,
userID: String? = nil,
completion: ((IPSError?) -> ())? = nil
)
This method performs the login operation using externally obtained tokens instead of an API key,
for users that do not have an API key. Like IPSCore.login(apiKey:), a successful login is required
to perform any IPS operation.
The SDK keeps the session alive with the supplied refresh token. Once the refresh token expires the
session cannot be renewed (there is no API key to re-login with) - the SDK then logs out and notifies
IPSCore.logoutDelegate. Obtaining fresh tokens and logging in again is the application's responsibility.
-
Since: 9.10.0
-
Parameters:
- accessToken: The access token (JWT) to authenticate requests with.
- accessTokenExpirationMillis: Epoch milliseconds at which
accessTokenexpires. An access token without an expiration is invalid. - refreshToken: The raw
refreshTokencookie that came withaccessToken. - refreshTokenExpirationMillis: Epoch milliseconds at which
refreshTokenexpires. - ipsDomain: Your IPS domain as provided by Oriient.
- userID: An optional unique identifier which (non-personally identifiable) represents each signed-in user to enable analysis of sessions across devices. This ID is most often provided by an authentication system.
Parameters
| Name | Description |
|---|---|
| accessToken | The access token (JWT) to authenticate requests with. |
| accessTokenExpirationMillis | Epoch milliseconds at which accessToken expires. An access token without an expiration is invalid. |
| refreshToken | The raw refreshToken cookie that came with accessToken. |
| refreshTokenExpirationMillis | Epoch milliseconds at which refreshToken expires. |
| ipsDomain | Your IPS domain as provided by Oriient. |
| userID | An optional unique identifier which (non-personally identifiable) represents each signed-in user to enable analysis of sessions across devices. This ID is most often provided by an authentication system. |
logout(_:)
@objc public static func logout(_ completion: ((IPSError?) -> ())? = nil)
This method performs the logout operation. A logout operation clears all the user data and stops
any IPS engine operations. If the application is closed, the SDK will assume logout and a new
IPSCore.login(apiKey:) will be necessary to continue using the IPS engine upon relaunching of
the application.
Note that user data will be cleared regardless of weather the logout operation succeeds or not.
getIPSClientId()
@objc public static func getIPSClientId() -> String
- Returns: Unique installation Id
getLoggedInUserId()
@objc public static func getLoggedInUserId() -> String?
-
Returns: The currently logged in user id or nil if not logged in.
-
Since: 2.10.0
getSelectedSpaceId()
@objc public static func getSelectedSpaceId() -> String?
- Since: 2.9.0
- Returns: The selected space id or nil if not selected.
getAvailableSpaces()
@objc public static func getAvailableSpaces() -> [IPSSpace]
- Since: 2.9.0
- Returns: The available spaces for the current api key, empty if not logged in.
setSelectedSpaceId(_:_:)
@objc public static func setSelectedSpaceId(_ id: String, _ listener: @escaping (IPSError?) -> ())
A method to set a selected space id.
-
Since: 2.9.0
-
Parameters:
- id: id of the space.
- listener: The closure will be called after the execution, with an parameter: nil in case of success or
IPSErrorin case of fail.
Parameters
| Name | Description |
|---|---|
| id | id of the space. |
| listener | The closure will be called after the execution, with an parameter: nil in case of success or IPSError in case of fail. |
setUserId(_:_:)
@objc public static func setUserId(_ id: String?, _ listener: @escaping (IPSError?) -> ())
A method to set a user ID for sessions attribution.
-
Since: 2.20.0
-
Parameters:
- id: id of the user.
- listener: The closure will be called after the execution, with an parameter: nil in case of success or
IPSErrorin case of fail.
Parameters
| Name | Description |
|---|---|
| id | id of the user. |
| listener | The closure will be called after the execution, with an parameter: nil in case of success or IPSError in case of fail. |
getConnectionState()
@objc public static func getConnectionState() -> IPSCore.ConnectionState
- Returns: The current
IPSCore.ConnectionStateof the IPS engine.
getVersionName()
@objc public static func getVersionName() -> String
- Returns: The current SDK version name.
setFrameworkLogLevel(_:)
@objc public static func setFrameworkLogLevel(_ level: IPSLogLevel)
Enables the application user to set the log prints level of the SDK. Only allows for IPSLogLevel.info or less.
isDebug()
@objc public static func isDebug() -> Bool
- Returns: true if the SDK has been compiled in Debug or false otherwise.
getBuildingById(_:onSuccess:onError:)
@objc public static func getBuildingById(
_ id: String,
onSuccess: @escaping (IPSBuilding) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
A method for receiving an IPSBuilding object by ID.
The object will contain all the information about a specific building.
-
Since: 2.10.0
-
Parameters:
- id: The ID of the building to receive.
Parameters
| Name | Description |
|---|---|
| id | The ID of the building to receive. |
searchBuildingsByName(_:onSuccess:onError:)
@objc public static func searchBuildingsByName(_ name: String,
onSuccess: @escaping ([IPSBuildingsSearchResult]) -> Void,
onError: @escaping (IPSError) -> Void) -> IPSCancellable
A method for searching buildings by name. The search is only possible if a login was performed.
-
Since: 2.10.0
-
Parameters:
- name: The name of the building to search for. May be a part of a name. Key sensitive. An empty name will return all available buildings.
- onSuccess: Completion block with the relevant buildings
- onError: Failed response block with the error description
searchBuildingsByLocation(latitude:longitude:onSuccess:onError:)
@objc public static func searchBuildingsByLocation(latitude: Double,
longitude: Double,
onSuccess: @escaping ([IPSBuildingsSearchResult]) -> Void,
onError: @escaping (IPSError) -> Void) -> IPSCancellable
A method for searching buildings located in proximity to a specific location. The search is only possible if a login was performed.
-
Since: 2.10.0
-
Parameters:
- latitude: The latitude of the location coordinate.
- longitude: The longitude of the location coordinate.
- onSuccess: Completion block with the relevant buildings
- onError: Failed response block with the error description
searchBuildingsByLocation(latitude:longitude:radiusMeters:onSuccess:onError:)
@objc public static func searchBuildingsByLocation(latitude: Double,
longitude: Double,
radiusMeters: Double,
onSuccess: @escaping ([IPSBuildingsSearchResult]) -> Void,
onError: @escaping (IPSError) -> Void) -> IPSCancellable
A method for searching buildings located in proximity to a specific location. The search is only possible if a login was performed.
-
Since: 2.10.0
-
Parameters:
- latitude: The latitude of the location coordinate.
- longitude: The longitude of the location coordinate.
- radiusMeters: The radius in which the search should be performed
- onSuccess: Completion block with the relevant buildings
- onError: Failed response block with the error description
Parameters
| Name | Description |
|---|---|
| latitude | The latitude of the location coordinate. |
| longitude | The longitude of the location coordinate. |
| radiusMeters | The radius in which the search should be performed |
| onSuccess | Completion block with the relevant buildings |
| onError | Failed response block with the error description |
getMapById(buildingId:floorId:mapId:onSuccess:onError:)
@objc public static func getMapById(
buildingId: String,
floorId: String,
mapId: String,
onSuccess: @escaping (IPSMap) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
A method for receiving an IPSMap object with the map metadata.
- Warning: Deprecated since 8.5.0. Use getFloorMapById(buildingId:floorId:onSuccess:onError:) instead.
- Since: 4.1.0
-
Deprecated: 8.5.0
-
Parameters:
- buildingId: The buildingId of the map to receive.
- floorId: The floorId of the map to receive.
- mapId: The mapId of the map to receive.
- onSuccess: Completion block with the map object
- onError: Failed response block with the error description
Parameters
| Name | Description |
|---|---|
| buildingId | The buildingId of the map to receive. |
| floorId | The floorId of the map to receive. |
| mapId | The mapId of the map to receive. |
| onSuccess | Completion block with the map object |
| onError | Failed response block with the error description |
getFloorMapById(buildingId:floorId:onSuccess:onError:)
public static func getFloorMapById(
buildingId: String,
floorId: String,
onSuccess: @escaping (IPSFloorImageData) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
A method for receiving an IPSFloorImageData object.
- Since: 8.5.0
- Parameters:
- buildingId: The buildingId of the map to receive.
- floorId: The floorId of the map to receive.
- onSuccess: Completion block with the map object
-
onError: Failed response block with the error description
-
Note: This method replaces the deprecated
getMapById(buildingId:floorId:mapId:onSuccess:onError:).
Parameters
| Name | Description |
|---|---|
| buildingId | The buildingId of the map to receive. |
| floorId | The floorId of the map to receive. |
| onSuccess | Completion block with the map object |
| onError | Failed response block with the error description |
application(_:handleEventsForBackgroundURLSession:completionHandler:)
@objc public static func application(
_ application: UIApplication,
handleEventsForBackgroundURLSession identifier: String,
completionHandler: @escaping () -> Void
) -> Bool
Call this method from the related UIApplicationDelegate method to handle the data uploading results.
-
Since: 3.4.0
-
Returns: true if the background session identifier is relevant and will be handled, false if the event should be processed by the client.
clearAllCaches(onSuccess:onError:)
@objc public static func clearAllCaches(onSuccess: @escaping () -> Void, onError: @escaping (IPSError) -> Void)
A method to clear the SDK caches: maps, buildings, logs, images. - Since: 3.5.0
- Parameters:
- onSuccess: Completion block
- onError: Failed response block with the error description
Parameters
| Name | Description |
|---|---|
| onSuccess | Completion block |
| onError | Failed response block with the error description |
createCoordinatesConverter(buildingId:onSuccess:onError:)
@objc public static func createCoordinatesConverter(
buildingId: String,
onSuccess: @escaping (IPSBuildingCoordinatesConverter) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
Create an IPSBuildingCoordinatesConverter that will allow to convert between coordinates systems.
Requires an internet connection.
-
Since: 3.6.0
-
Parameters:
- buildingId: The ID of the relevant building;
- onSuccess: Completion block;
- onError: Failed response block with the error description.
Parameters
| Name | Description |
|---|---|
| buildingId | The ID of the relevant building; |
| onSuccess | Completion block; |
| onError | Failed response block with the error description. |
getBuildingLayout(buildingId:onSuccess:onError:)
@discardableResult public static func getBuildingLayout(
buildingId: String,
onSuccess: @escaping (IPSBuildingLayout) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
Retrieves the layout for a building with the specified building ID. This method makes an asynchronous request to obtain the building layout.
- Parameters:
- buildingId: The ID of the relevant building;
- onSuccess: A closure that is called with the
IPSBuildingLayoutobject if the building layout is successfully retrieved. -
onError: A closure that is called with an
IPSErrorobject if an error occurs while fetching the building layout. -
Returns: An
IPSCancellableobject that can be used to cancel the request if necessary. -
Since: 8.3.0
Parameters
| Name | Description |
|---|---|
| buildingId | The ID of the relevant building; |
| onSuccess | A closure that is called with the IPSBuildingLayout object if the building layout is successfully retrieved. |
| onError | A closure that is called with an IPSError object if an error occurs while fetching the building layout. |
registerApplicationEvent(_:)
@objc public static func registerApplicationEvent(_ event: IPSApplicationEvent)
Register an application event. - Since: 4.0.0
unavailableFeatures()
@objc public static func unavailableFeatures() -> [IPSUnavailableFeature]
This method provides the list of the SDK features unavailable for the current device, usually due to its hardware limitations. Make sure to check it after the login command is done, the list before the login can be incomplete. - Since: 4.0.0
getBuildingByClientId(clientBuildingId:onSuccess:onError:)
@objc public static func getBuildingByClientId(
clientBuildingId: String,
onSuccess: @escaping (IPSBuilding) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
A method for receiving an IPSBuilding object by client building ID.
The object will contain all the information about a specific client building.
-
Since: 5.1.0
-
Parameters:
- clientBuildingId: The ID of the client building to receive.
Parameters
| Name | Description |
|---|---|
| clientBuildingId | The ID of the client building to receive. |
getClientBuildingId(oriientBuildingId:onSuccess:onError:)
@objc public static func getClientBuildingId(
oriientBuildingId: String,
onSuccess: @escaping (String) -> Void,
onError: @escaping (IPSError) -> Void
) -> IPSCancellable
A method for receiving a client ID of an object.
-
Since: 5.1.0
-
Parameters:
- oriientBuildingId: The ID of the Oriient building.
Parameters
| Name | Description |
|---|---|
| oriientBuildingId | The ID of the Oriient building. |
userDidEngageWithFeature(_:)
@objc public static func userDidEngageWithFeature(_ feature: String)
Use this API to indicate that a user has engaged with a location-based feature.
-
Since: 8.7.0
-
Parameters:
- feature: Short unique name of the feature.
Parameters
| Name | Description |
|---|---|
| feature | Short unique name of the feature. |
setCrashReportsEnrichment(enabled:)
@objc public static func setCrashReportsEnrichment(enabled: Bool)
Enables enrichment of the host app's crash reports with Oriient SDK context.
When enabled (and if Crashlytics is integrated and initialized in the host app), the Oriient SDK attaches the following custom keys to Crashlytics so that crash reports surface Oriient context that helps diagnose SDK-related issues:
oriientInstallationId: generated by the Oriient SDK to identify the installation.oriientSessionId: id of the current positioning session, if positioning is not idle.-
oriientBuildingId: id of the current building. -
Since: 9.7.0
-
Parameters:
- enabled: the value to set for this property.
Parameters
| Name | Description |
|---|---|
| enabled | the value to set for this property. |