How to enable push notifications for the ASAP iOS SDK?
You can configure the ASAP help widget to send notifications to end-users when an agent responds via chat. The critical component in making this possible on the SDK is an Apple Push Notification (APN) service certificate in the .p12 format.
To generate a .p12 formatted file of the APN certificate, perform the following steps:
1. Create and download an APN certificate from Apple's developer portal.
2. Double-click the certificate. This action automatically imports it to the Keychain Access application.
3. Locate and expand the certificate in Keychain Access. The corresponding key for the certificate appears.
4. Select both the certificate and the key and right-click on them. A context menu will appear.
5. Click the export option, a dialog box will appear.
6. In this dialogue box, make sure that .p12 is selected in the File Format drop-down list and click Save.
7. Enter a password to access the file and click .Ok The certificate is now exported as a .p12 file.
The following step is to enable push notifications in the Zoho Desk ASAP setup page. To do so, begin on the setup page for the help widget on Zoho Desk and upload the .p12 file you created with the password to access the file.
Next, configure the help widget to invoke the enablePushNotification API call inside the application: the didRegisterForRemoteNotificationsWithDeviceToken method in the AppDelegate.
Swift
- func application
(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
let token = deviceToken.reduce
("", {$0 + String(format: "%02X", $1)}).uppercased()
ZohoDeskPortalSDK.enablePushNotification
(deviceToken:token, mode: .production)
}
Objective-C
- - (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString * token = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
[ZohoDeskPortalSDK enablePushNotificationWithDeviceToken:<#(NSString * _Nonnull)#> isTestDevice:<#(BOOL)#> mode:<#(enum APNSmode)#>];
}

You can verify if the notifications are sent accurately by testing the functionality in development mode. To switch to development mode, replace ".production" in the code snippet above with ".sandbox". Switch back to production mode before deploying the app for end-customer use.
Next, you must configure the SDK to automatically invoke the didReceiveRemoteNotification method in the AppDelegate when a push notification is received. For the SDK to process the notification received and perform the corresponding operation, the processRemoteNotification method must be invoked with details of the notification, as follows.
Swift
- import ZohoDeskPortalConfiguration
...
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any])
{
ZDPortalConfiguration.processRemoteNotification(userInfo: userInfo)
}
Objective-C
- @import ZohoDeskPortalConfiguration;
...
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)
(UIBackgroundFetchResult))completionHandler
{
[ZDPortalConfiguration processRemoteNotificationWithUserInfo:userInfo];
}