Protocol
| ZPNsManager | ZPNsNotificationCenterDelegate |
ZPNsManager
Details
ZPNsManager SDK main class.
Declared in ZPNs.h
Methods
getVersion
+ (NSString *)getVersion;ZPNs.hIf you encounter an abnormality during the running of the SDK, you can submit the problem, log and other information to the ZEGO technical staff to locate and troubleshoot. Developers can also collect current SDK version information through this API, which is convenient for App operation statistics and related issues.
- When to call:Any time.
- Caution:None.
- Available since:1.0.0
- Restrictions:None.
SDK version.
setPushConfig
+ (void)setPushConfig:(ZPNsConfig) config;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| config | ZPNsConfig |
Details
Set push Settings for each vendor.
- Use cases:Developers need to use this method to set up configurations pushed by vendors.
- Caution:Called when vendor push needs to be set.
- Available since:2.0.0 or later.
shared
+ (ZPNs *)getInstance;ZPNs.h- Supported Versions:2.0.0 and above. Detailed Description: When using the ZPNs SDK, developers shall directly call this API to obtain the internal singleton object instead of creating and maintaining the object on their own.
- Calling Timing:Any time.
- Usage Restrictions:None.
- Caution:This method must be used to get the ZPNs singleton object when utilizing ZPNs.
SDK singleton object for subsequent API calls
setZPNsNotificationCenterDelegate:
- (void)on<K extends keyof ZPNsEventHandler>:() delegate;Parameters
| Name | Type | Description |
|---|---|---|
| delegate | A callback object that implements the ZPNs callback protocol. |
- Supported versions:2.0.0 and above. Detailed description: Configure event notification callbacks to listen for callbacks such as successful ZPNs registration events and push notification clicks.
- Usage restrictions:None.
setDeviceToken
- (void)setDeviceToken:(NSData *) deviceToken :(BOOL) isProduct;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| deviceToken | NSData * | |
| isProduct | BOOL |
Details
Use this method to pass deviceToken into ZPNs and get PushID.
- Use cases:This method should be used after the official iOS interface didRegisterForRemoteNotificationsWithDeviceToken trigger, and on this interface will be incoming deviceToken parameters. When to call /Trigger: Official iOS interface didRegisterForRemoteNotificationsWithDeviceToken trigger after use.
- Caution:The isProduct Boolean value for this method is false for development and true for production.
- Available since:2.0.0 or later.
setVoipToken
- (void)setVoipToken:(NSData *) deviceToken :(BOOL) isProduct;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| deviceToken | NSData * | |
| isProduct | BOOL |
registerAPNs
- (void)registerAPNs;ZPNs.hThis method is used to register vendor offline push.
- Use cases:This method is called when a developer needs to use offline push.
- Available since:ZPNs 2.0.0 or later.
unregisterAPNs
- (void)unregisterAPNs;ZPNs.hCall this method to de-register when offline push is not required.
- Use cases:This method can be called to de-register when a user clicks a close message notification within the application. When to call /Trigger: Called when de-registration is required.
- Caution:It needs to be called after [registerPush] is called.
- Available since:2.0.0 or later.
addLocalNotificationWithContent:trigger:withCompletionHandler:
- (void)addLocalNotificationWithContent:(UNMutableNotificationContent *) content trigger:(UNTimeIntervalNotificationTrigger *) trigger withCompletionHandler:(void (^)(NSError *__nullable error)) completionHandler;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| content | UNMutableNotificationContent * | Please refer to Apple's official documentation UNMutableNotificationContent. |
| trigger | UNTimeIntervalNotificationTrigger * | Please refer to Apple's official documentation UNTimeIntervalNotificationTrigger. |
| completionHandler | void (^)(NSError *__nullable error) |
Details
When the developer's App is in the foreground or has just been pushed to the background and is not frozen, the background will not send offline pushes if the background does not perceive that the user is offline. At this time, if the developer needs to supplement the push notification, he can use this interface to manually send a local push message to the device.
addLocalNotificationRequest:withCompletionHandler:
- (void)addLocalNotificationRequest:(UNNotificationRequest *) request withCompletionHandler:(void (^)(NSError *__nullable error)) completionHandler;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| request | UNNotificationRequest * | Please refer to Apple's official documentation UNNotificationRequest. |
| completionHandler | void (^)(NSError *__nullable error) | The block to execute with the results. Please refer to Apple's official documentation. |
Details
When the developer's App is in the foreground or has just been pushed to the background and is not frozen, the background will not send offline pushes if the background does not perceive that the user is offline. At this time, if the developer needs to supplement the push notification, he can use this interface to manually send a local push message to the device.
setBadge:
- (void)setBadge:(int) badge;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| badge | int | The value to be set. |
- Available since version 2.6.0 or later. Description the number of corners of the current App to the ZPNs server through this interface. When the app is offline, the ZPNs changes based on the previously reported corner mark number.
- Use cases:When the local corner of the developer is changed, this interface is called to report the change. Default value the receiver does not report the badge, the corner mark will not be modified when the push is sent. When to call /Trigger can be called at any time, but the actual time reported to the background is after pushID has successfully registered and the user has logged in, and before logging out.
- Caution:Badge cannot be less than 0.
- Restrictions:There is no single interface frequency limit. Currently, you need to configure this interface only for iOS.
ZPNsNotificationCenterDelegate
Details
Declared in ZPNs.h
Methods
onRegistered
- (void)onRegistered:(NSString *) pushID;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| pushID | NSString * |
- Available since:2.0.0.
ZPNsNotificationCenter:didReceiveNotificationResponse:userInfo:withCompletionHandler:
- (void)ZPNsNotificationCenter:didReceiveNotificationResponse:userInfo:withCompletionHandler:;ZPNs.hZPNsNotificationCenter:willPresentNotification:userInfo:withCompletionHandler:
- (void)ZPNsNotificationCenter:(UNUserNotificationCenter *) center willPresentNotification:(UNNotification *) notification userInfo:(NSDictionary *) userInfo withCompletionHandler:(void (^)(UNNotificationPresentationOptions)) completionHandler;ZPNs.hParameters
| Name | Type | Description |
|---|---|---|
| center | UNUserNotificationCenter * | |
| notification | UNNotification * | |
| userInfo | NSDictionary * | |
| completionHandler | void (^)(UNNotificationPresentationOptions) |
