EMMobileMessenger
Objective-C
@interface EMMobileMessenger : NSObject
Swift
class EMMobileMessenger : NSObject
EMMobileMessenger represents the entry point to the SDK features related to messaging.
Since
5.3-
Singleton instance of EMMobileMessenger
Declaration
Objective-C
+ (nullable instancetype)sharedInstance;Swift
class func sharedInstance() -> Self?Return Value
The singleton EMMobileMessenger instance. This method requires EMMobileMessenger to be configured
-
Perform the registration of the user to the OOBS.
Declaration
Objective-C
- (void) registerWithUserId:(nonnull NSString *)userId userAlias:(nonnull NSString *)userAlias registrationCode:(nonnull NSString *)registrationCode customHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers completionHandler:(nonnull void (^)(EMRegistrationResponse *_Nullable, NSError *_Nullable))completionHandler;Swift
func register(userId: String, userAlias: String, registrationCode: String, customHeaders headers: [String : String]?) async throws -> EMRegistrationResponseParameters
userIdThe ID of the user who registers to the OOBS.
userAliasHuman readable alias for this client.
registrationCodeRegistration is authorised by the registration code entered by the user via the application UI.
headersThe request parameter containing custom header.
completionHandlerThe block to invoke on the main thread upon completion which contains the response and error information if any.
-
Performs the unregistration of the user to the OOBS.
Declaration
Objective-C
- (void)unregisterWithCustomHeaders: (nullable NSDictionary<NSString *, NSString *> *)headers completionHandler:(nonnull void (^)(BOOL, NSError *_Nullable)) completionHandler;Swift
func unregister(customHeaders headers: [String : String]?) async throws -> BoolParameters
headersThe request parameter containing custom header.
completionHandlerThe block to invoke on the main thread upon completion which contains the status and error information if any.
-
Performs the unregistration of the user to the OOBS.
Declaration
Objective-C
- (void)unregisterWithClientId:(nonnull NSString *)clientId customHeaders: (nullable NSDictionary<NSString *, NSString *> *)headers completionHandler: (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;Swift
func unregister(clientId: String, customHeaders headers: [String : String]?) async throws -> BoolParameters
clientIdThe ID of the user who unregister from the OOBS.
headersThe request parameter containing custom header.
completionHandlerThe block to invoke on the main thread upon completion which contains the status and error information if any.
-
Sets/Clear the notification profile. SDK updates the notification profile on the OOB server on the first time. In subsequent invocation to this API, SDK checks the value of the endPoint. Notification profile is updated if the endPoint value is different from previous value. Otherwise SDK skips the server call.
Declaration
Objective-C
- (void)refreshTokenWithChannel:(nonnull NSString *)channel endPoint:(nullable NSString *)endPoint customHeaders: (nullable NSDictionary<NSString *, NSString *> *)headers completionHandler: (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;Swift
func refreshToken(channel: String, endPoint: String?, customHeaders headers: [String : String]?) async throws -> BoolParameters
channelThe channel to use for the notification (SMS, push, email, etc.)
endPointValue associated with this channel.
headersThe request parameter containing custom header.
completionHandlerThe block to invoke on the main thread upon completion which contains the response and error information if any.
-
Sets/Clear the notification profile. SDK updates the notification profile on the OOB server on the first time. In subsequent invocation to this API, SDK checks the value of the endPoint. Notification profile is updated if the endPoint value is different from previous value. Otherwise SDK skips the server call.
Declaration
Objective-C
- (void)refreshTokenWithClientId:(nonnull NSString *)clientId channel:(nonnull NSString *)channel endPoint:(nullable NSString *)endPoint customHeaders: (nullable NSDictionary<NSString *, NSString *> *)headers completionHandler:(nonnull void (^)(BOOL, NSError *_Nullable)) completionHandler;Swift
func refreshToken(clientId: String, channel: String, endPoint: String?, customHeaders headers: [String : String]?) async throws -> BoolParameters
clientIdThe ID of the user who registered with the OOBS.
channelThe channel to use for the notification (SMS, push, email, etc.)
endPointValue associated with this channel.
headersThe request parameter containing custom header.
completionHandlerThe block to invoke on the main thread upon completion which contains the response and error information if any.
-
Retrieve the Set of names of existing clientIds in the database.
Declaration
Objective-C
- (nonnull NSSet<NSString *> *)clientIds;Swift
func clientIds() -> Set<String>Return Value
The set of names of existing clientIds in the database.
-
Retrieve the Set of names of existing clientIds in the database.
Declaration
Objective-C
- (nonnull NSSet<NSString *> *)clientIdsForUserId:(nonnull NSString *)userId;Swift
func clientIds(userId: String) -> Set<String>Parameters
userIdThe ID associated with the clientId.
Return Value
The set of names of existing clientIds in the database.
-
Returns the default OOB message manager.
Declaration
Objective-C
- (nullable EMMobileMessageManager *) defaultMessageManagerWithProviderId:(nonnull NSString *)providerId error:(NSError *_Nullable *_Nullable)error;Swift
func defaultMessageManager(providerId: String) throws -> EMMobileMessageManagerParameters
providerIdThe ID of the provider used for message communication.
errorIf an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in
NULL.Return Value
The OOB message manager.
-
Returns the OOB message manager.
Declaration
Objective-C
- (nullable EMMobileMessageManager *) messageManagerWithClientId:(nonnull NSString *)clientId providerId:(nonnull NSString *)providerId error:(NSError *_Nullable *_Nullable)error;Swift
func messageManager(clientId: String, providerId: String) throws -> EMMobileMessageManagerParameters
clientIdThe ID associated with the clientId.
providerIdThe ID of the provider used for message communication.
errorIf an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in
NULL.Return Value
The OOB message manager.
-
If your client was registered using Old Mobile Protector SDK, call this method to insert your clientId so you can use your existing data with the new APIs.
Declaration
Objective-C
- (BOOL)persistClientId:(nonnull NSString *)clientId userId:(nonnull NSString *)userId error:(NSError *_Nullable *_Nullable)error;Swift
func persist(clientId: String, userId: String) throwsParameters
clientIdThe ID associated with the clientId.
userIdThe ID associated with the clientId.
errorIf an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in
NULL.Return Value
The migration status.
EMMobileMessenger Class Reference