Hello 👋 How can we help?

Messages

Written by Konstantine
Updated 1 month ago

In order to display the number of new messages in your application, fetch unread messages from the server. Use once after initializing HelpCrunch SDK:

ObjC:
[HelpCrunch checkUnreadMessages:^(NSUInteger numberOfUnreadMessages) {
  // show a badge somewhere in your application
}];
Swift:
HelpCrunch.checkUnreadMessages { (numberOfUnreadMessages) in
  // show a badge somewhere in your application
}

Initiate every time you want to display the number on unread messages on UI using the following method:

ObjC:
NSUInteger numberOfUnreadMessages = [HelpCrunch numberOfUnreadMessages];
Swift:
let numberOfUnreadMessages = HelpCrunch.numberOfUnreadMessages()

Did this answer your question?