NSNotificationCenter Class
NSNotificationCenter is the primary means through which an application can receive information from the BFG SDK about events. More...
Public Member Functions | |
void | addObserver (@NonNull final Object notificationObserver, @NonNull final String notificationSelector, @NonNull final String notificationName) |
Adds an observer for the specified notification. More... | |
void | addObserver (@NonNull final Object notificationObserver, @NonNull final String notificationSelector, @NonNull final String notificationName, @Nullable final Object notificationSender) |
Adds an observer for the specified notification. More... | |
void | postNotification (@NonNull final NSNotification notification, final long delay) |
Places the notification in the message queue for handling after the specified delay. More... | |
void | removeObserver (@NonNull final Object notificationObserver) |
Removes a previously registered observer for a notification. More... | |
void | removeObserver (@NonNull final Object notificationObserver, @NonNull final String notificationName, @Nullable final Object notificationSender) |
Removes an observer from a notification. More... | |
Static Public Member Functions | |
static NSNotificationCenter | defaultCenter () |
Gets the singleton instance of NSNotificationCenter. More... | |
static void | postNotification (@NonNull final String notificationName) |
Dispatch a simple notification where only the notification name is needed. More... | |
static void | postNotificationWithParameter (@NonNull final String notificationName, Object parameter) |
Dispatch a simple notification where only the notification name is needed. More... | |
Detailed Description
NSNotificationCenter is the primary means through which an application can receive information from the BFG SDK about events. Please refer to the documentation for individual bfg* classes to find out more about notifications that you can register to observe.IMPORTANT: Observer methods will be invoked on the UI thread. Don't do excessive processing in a notification handler.
Member Function Documentation
◆ addObserver() [1/2]
| inline |
Adds an observer for the specified notification. When the notification is received by the NSNotificationCenter, it invokes all selectors registered for the notification.
- Parameters
notificationObserver Instance of class observing this event notificationSelector Name of the method in the observing class that will be invoked when the notification is raised. The instance of the method will be found using reflection notificationName Name of the notification to listen for
◆ addObserver() [2/2]
| inline |
Adds an observer for the specified notification. When the notification is received by the NSNotificationCenter, it invokes all selectors registered for the notification.
- Parameters
notificationObserver Instance of class observing this event notificationSelector Name of the method in the observing class that will be invoked when the notification is raised. The instance of the method will be found using reflection notificationName Name of the notification to listen for notificationSender Deprecated. Provide as NULL
◆ defaultCenter()
| inlinestatic |
Gets the singleton instance of NSNotificationCenter. Be sure to initialize the SDK before calling or it will return null.
- Returns
- the shared default instance of the NSNotificationCenter or null if it has not been initialized.
◆ postNotification() [1/2]
| inline |
Places the notification in the message queue for handling after the specified delay.
- Parameters
notification Notification to be posted. delay Time interval in seconds.
◆ postNotification() [2/2]
| inlinestatic |
Dispatch a simple notification where only the notification name is needed.
- Parameters
notificationName Name of the notification to raise
◆ postNotificationWithParameter()
| inlinestatic |
Dispatch a simple notification where only the notification name is needed.
- Parameters
notificationName Name of the notification to raise parameter Parameter to provide with notification
◆ removeObserver() [1/2]
| inline |
Removes a previously registered observer for a notification. If the observer is listening for multiple notifications, all listeners will be removed.
- Parameters
notificationObserver Instance of class observing zero or more notifications
◆ removeObserver() [2/2]
| inline |
Removes an observer from a notification.
- Parameters
notificationObserver Observer instance registered for notification name notificationName Name of notification to remove observer from notificationSender Deprecated; Provide NULL