Overview
The message manager lets you create publications and subscriptions.
They are valid only as long as the manager exists.
Inherits NSObject.
Instance Method Summary | |
(instancetype) | - initWithAPIKey: |
Initializes the messages manager. More... | |
(instancetype) | - initWithAPIKey:paramsBlock: |
Initializes the messages manager with additional parameters. More... | |
(id< GNSPublication >) | - publicationWithMessage: |
Publishes a message. More... | |
(id< GNSPublication >) | - publicationWithMessage:paramsBlock: |
Publishes a message with additional parameters. More... | |
(id< GNSSubscription >) | - subscriptionWithMessageFoundHandler:messageLostHandler: |
Subscribes to all messages published by your app. More... | |
(id< GNSSubscription >) | - subscriptionWithMessageFoundHandler:messageLostHandler:paramsBlock: |
Subscribes to messages published by your app, with additional parameters. More... | |
Class Method Summary | |
(void) | + setDebugLoggingEnabled: |
Enables or disables debug logging. More... | |
(BOOL) | + isDebugLoggingEnabled |
Returns the current debug logging state. More... | |
Method Detail
- (instancetype) initWithAPIKey: | (NSString *) | apiKey |
Initializes the messages manager.
- Parameters
-
apiKey The API key of the app, required to use the Messages service
- (instancetype) initWithAPIKey: | (NSString *) | apiKey | |
paramsBlock: | (void(^)(GNSMessageManagerParams *)) | paramsBlock | |
Initializes the messages manager with additional parameters.
- Parameters
-
apiKey The API key of the app, required to use the Messages service paramsBlock Use this block to pass additional parameters
- (id<GNSPublication>) publicationWithMessage: | (GNSMessage *) | message |
Publishes a message.
Release the publication object to unpublish the message.
- Parameters
-
message The message to publish
- Returns
- Publication object; release to unpublish
- (id<GNSPublication>) publicationWithMessage: | (GNSMessage *) | message | |
paramsBlock: | (void(^)(GNSPublicationParams *)) | paramsBlock | |
Publishes a message with additional parameters.
Release the publication object to unpublish the message.
- Parameters
-
message The message to publish paramsBlock Use this block to pass additional parameters
- Returns
- Publication object; release to unpublish
- (id<GNSSubscription>) subscriptionWithMessageFoundHandler: | (GNSMessageHandler) | messageFoundHandler | |
messageLostHandler: | (GNSMessageHandler) | messageLostHandler | |
Subscribes to all messages published by your app.
Release it to stop subscribing. When a new message is received from a nearby device, is called; when the message is no longer heard, is called.
- Parameters
-
messageFoundHandler Block that's called when a new message is discovered messageLostHandler Block that's called when a previously discovered message is lost
- Returns
- Subscription object; release to cancel the subscription
- (id<GNSSubscription>) subscriptionWithMessageFoundHandler: | (GNSMessageHandler) | messageFoundHandler | |
messageLostHandler: | (GNSMessageHandler) | messageLostHandler | |
paramsBlock: | (void(^)(GNSSubscriptionParams *)) | paramsBlock | |
Subscribes to messages published by your app, with additional parameters.
For instance, you can subscribe to a subset of messages. Release it to stop subscribing.
- Parameters
-
messageFoundHandler Block that's called when a new message is discovered messageLostHandler Block that's called when a previously discovered message is lost paramsBlock Use this block to pass additional parameters
- Returns
- Subscription object; release to cancel the subscription
+ (void) setDebugLoggingEnabled: | (BOOL) | enabled |
Enables or disables debug logging.
When enabled, log messages for internal operations are written to the console to help with debugging, even in release builds. This is useful for debugging problems encountered by 3rd party clients. By default, it is disabled, even in debug builds.
+ (BOOL) isDebugLoggingEnabled |
Returns the current debug logging state.