WonderPush Class Reference
Inherits from | NSObject |
Declared in | WonderPush.h |
Overview
WonderPush
is your main interface to the WonderPush SDK.
Make sure you properly installed the WonderPush SDK, as described in the guide.
You must call setClientId:secret:
before using any other method.
Troubleshooting tip: As the SDK should not interfere with your application other than when a notification is to be shown, make sure to monitor your logs for WonderPush output during development, if things did not went as smoothly as they should have.
Tasks
Initialization
Push Notification handling
-
+ setNotificationEnabled:
-
+ handleApplicationLaunchWithOption:
-
+ handleDidReceiveRemoteNotification:
-
+ didRegisterForRemoteNotificationsWithDeviceToken:
-
+ handleNotification:
-
+ handleNotificationReceivedInBackground:
Application state monitoring
Installation data and events
Class Methods
applicationDidBecomeActive:
Forwards an application delegate to the SDK.
+ (void)applicationDidBecomeActive:(UIApplication *)application
Parameters
- application
The application provided by the system.
Discussion
Forwards an application delegate to the SDK.
Method to call in your applicationDidBecomeActive:
method of your AppDelegate
.
Declared In
WonderPush.h
applicationDidEnterBackground:
Forwards an application delegate to the SDK.
+ (void)applicationDidEnterBackground:(UIApplication *)application
Parameters
- application
The application provided by the system.
Discussion
Forwards an application delegate to the SDK.
Method to call in your applicationDidEnterBackground:
method of your AppDelegate
.
Declared In
WonderPush.h
didRegisterForRemoteNotificationsWithDeviceToken:
Forwards an application delegate to the SDK.
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
Parameters
- deviceToken
The device token provided by the system.
Discussion
Forwards an application delegate to the SDK.
Method call in your application:didRegisterForRemoteNotificationsWithDeviceToken:
method of your AppDelegate
.
Declared In
WonderPush.h
handleApplicationLaunchWithOption:
Forwards an application delegate to the SDK.
+ (BOOL)handleApplicationLaunchWithOption:(NSDictionary *)launchOptions
Parameters
- launchOptions
The launch options.
Discussion
Forwards an application delegate to the SDK.
Method to call in your application:didFinishLaunchingWithOptions:
method of your AppDelegate
.
Declared In
WonderPush.h
handleDidReceiveRemoteNotification:
Forwards an application delegate to the SDK.
+ (BOOL)handleDidReceiveRemoteNotification:(NSDictionary *)userInfo
Parameters
- userInfo
The userInfo provided by the system.
Discussion
Forwards an application delegate to the SDK.
Method call in your application:didReceiveRemoteNotification:
method of your AppDelegate
.
Declared In
WonderPush.h
handleNotification:
Forwards an application delegate to the SDK.
+ (BOOL)handleNotification:(NSDictionary *)notificationUserInfo
Parameters
- notificationUserInfo
The
UILocalNotification
userInfo
member.
Discussion
Forwards an application delegate to the SDK.
If your application uses backgroundModes/remote-notification, call this method in your
application:didReceiveLocalNotification:
method of your AppDelegate
.
Handles a notification and presents the associated dialog.
Declared In
WonderPush.h
handleNotificationReceivedInBackground:
Forwards an application delegate to the SDK.
+ (void)handleNotificationReceivedInBackground:(NSDictionary *)userInfo
Parameters
- userInfo
The userInfo provided by the system.
Discussion
Forwards an application delegate to the SDK.
If your application uses backgroundModes/remote-notification, call this method in your
application:didReceiveRemoteNotification:fetchCompletionHandler:
method
Declared In
WonderPush.h
isReady
Returns whether the WonderPush SDK is ready to operate. Returns YES when the WP_NOTIFICATION_INITIALIZED is sent.
+ (BOOL)isReady
Return Value
The initialization state as a BOOL
Discussion
Returns whether the WonderPush SDK is ready to operate. Returns YES when the WP_NOTIFICATION_INITIALIZED is sent.
Declared In
WonderPush.h
putInstallationCustomProperties:
Updates the custom properties attached to the current installation object stored by WonderPush.
+ (void)putInstallationCustomProperties:(NSDictionary *)customProperties
Parameters
- customProperties
The partial object containing only the properties to update.
Discussion
Updates the custom properties attached to the current installation object stored by WonderPush.
In order to remove a value, don’t forget to use [NSNull null]
as value.
Declared In
WonderPush.h
setClientId:secret:
Initializes the WonderPush SDK.
+ (void)setClientId:(NSString *)clientId secret:(NSString *)secret
Parameters
- clientId
Your WonderPush client id
- secret
Your WonderPush client secret
Discussion
Initializes the WonderPush SDK.
Initialization should occur at the earliest possible time, when your application starts.
A good place is the application:didFinishLaunchingWithOptions:
method of your AppDelegate
.
Please refer to the step entitled Initialize the SDK from the guide.
Declared In
WonderPush.h
setNotificationEnabled:
Activates or deactivates the push notification on the device (if the user accepts) and registers the device token with WondePush.
+ (void)setNotificationEnabled:(BOOL)enabled
Parameters
- enabled
The new activation state of push notifications.
Discussion
Activates or deactivates the push notification on the device (if the user accepts) and registers the device token with WondePush.
Declared In
WonderPush.h
setUserId:
Sets the user id, used to identify a single identity across multiple devices, and to correctly identify multiple users on a single device.
+ (void)setUserId:(NSString *)userId
Parameters
- userId
The user id, unique to your application. Use
nil
for anonymous users. You are strongly encouraged to use your own unique internal identifier.
Discussion
Sets the user id, used to identify a single identity across multiple devices, and to correctly identify multiple users on a single device.
If not called, the last used user id it assumed. Defaulting to nil
if none is known.
Prefer calling this method just before calling setClientId:secret:
, rather than just after.
Upon changing userId, the access token is wiped, so avoid unnecessary calls, like calling with null just before calling with a user id.
Declared In
WonderPush.h
trackEvent:withData:
Send an event to be tracked to WonderPush.
+ (void)trackEvent:(NSString *)type withData:(id)data
Parameters
- type
The event type, or name. Event types starting with an
@
character are reserved.
- data
A dictionary containing custom properties to be attached to the event. Prefer using a few custom properties over a plethora of event type variants.
Discussion
Send an event to be tracked to WonderPush.
Declared In
WonderPush.h