Issue with Call notification IOS

Hi team,
Cometchat is working fine.
But it is showing some issue when it is working for notification.
1- when the app is in background and any calling notification will come and click on notification then it showing only white screen. I already call call manager class.
And same issue for when app is in active. It working fine when we are in app.
Please give us any link for notification with cometchat with all stages.
Means accept and reject with data. Please explain us all senerios.
Because it is little bit difficult to handle comect chat notification
2- sometimes when open keyboard then navigation bar overlap status bar. Where is the issue.

Please suggest us ASAP. we are crazy for this feature in our app. But due to some issue we could not get proper solution.

I really appreciate your team who always helping us when we stuck in any issue.
I hope you will give a quick response of this.
Thanks

Hello @flipspot,

You need to manage it in your app delegate class when new call notification receives.

To open the Incoming Call Screen on tap of Push Notification, you need to handle this in below method.

func userNotificationCenter(_ center: UNUserNotificationCenter,
                didReceive response: UNNotificationResponse,
                withCompletionHandler completionHandler: @escaping () -> Void) {
   
    if let userInfo = response.notification.request.content.userInfo as? [String : Any], let messageObject = userInfo["message"], let str = messageObject as? String, let dict = str.stringTodictionary() {
       print("didReceive: \(userInfo)")
      if let baseMessage = CometChat.processMessage(dict).0 {
        switch baseMessage.messageCategory {
        case .message: break
        case .call:
 switch baseMessage.receiverType {
            case .user:
              // Launch Incoming Call Screen for User
            case .group:
               // Launch Incoming Call Screen for Group
            @unknown default: break
            }
        case .action: break
        case .custom: break
        @unknown default: break
        }
      }
    }
    completionHandler()
  }
__________________________________________________
extension String {
 func stringTodictionary() -> [String:Any]? {
  var dictonary:[String:Any]?
  if let data = self.data(using: .utf8) {
   do {
    dictonary = try JSONSerialization.jsonObject(with: data, options: []) as? [String : Any]
    if let myDictionary = dictonary
    {
     return myDictionary;
    }
   } catch let error as NSError {
    print(error)
   }
  }
  return dictonary;
 }
}
_______________

I hope this will resolve your concern.

  • Pushpsen
2 Likes

Hi @flipspot

I hope @pushpsen.airekar has answered your query. Please do let us know if you still have any issue or your query is not resolved.

Thanks
Nishant Tiwari

1 Like