Enabling iOS push notifications for the Chat SDK

Have more questions? Submit a request

5 Comments

  • song donghao
    Comment actions Permalink

    Our app used Token-based way to use APNs, do you support this way?

    0
  • Greg - Community Manager
    Comment actions Permalink

    Hi Song, at this time, we do not support token-based APNs. You would need to use the methods described in this article.

    Greg Katechis | Developer Support and Enablement Engineer

    0
  • Gabriel
    Comment actions Permalink

    Hi, can anybody confirm that this code is right?

    - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler{
    [ZDKChat didReceiveRemoteNotification:userInfo in:application];
    completionHandler();
    }

    I'm not an iOS developer (I'm making React Native app), and XCode is saying that userInfo and application are not defined, which makes sense for me, so I'm using this code:

    - (void) application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo {
      [ZDKChat didReceiveRemoteNotification:userInfo in:application];
    }

    Am I right? the code still not working for me, but at least I'll be one step farther to make it work :)

    0
  • Gabriel
    Comment actions Permalink

    Ok, now I can verify that the code was wrong, the code should be this:

    - (void)userNotificationCenter:(UNUserNotificationCenter *)center

    didReceiveNotificationResponse:(UNNotificationResponse *)response

             withCompletionHandler:(void (^)(void))completionHandler

    {

      NSDictionary* userInfo = response.notification.request.content.userInfo;

      UIApplication* application = UIApplication.sharedApplication;

      [ZDKChat didReceiveRemoteNotification:userInfo in:application];

      completionHandler();

    }
    1
  • Daniel Conway
    Comment actions Permalink

    Nice work, Gabriel! This is super helpful.

    0

Please sign in to leave a comment.

Powered by Zendesk