Skip to main content
Answered

IOS push notification not working with ionic

  • 20 November 2024
  • 1 reply
  • 33 views

I configured IOS for intercom correctly with APNS Key but still i didn't receive any notification, if the agent send a message to my iphone

Best answer by bernice

Hey ​@Dhrupad Purohit 👋 I see you got in touch with the team via the Messenger and gotten this resolved 💬✅

 

For anyone else facing this issue - background mode push notification capabilities from Xcode needed to enabled along with some changes in AppDelegate.swift file, like below:

 

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Intercom.setDeviceToken(deviceToken) NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken) }

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error) }

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { NotificationCenter.default.post(name: Notification.Name.init("didReceiveRemoteNotification"), object: completionHandler, userInfo: userInfo) }


For more information on iOS Push Notifications, you can check out our Developer Documentation here 📌

View original
Did this topic help you find an answer to your question?

1 reply

bernice
Intercom Team
Forum|alt.badge.img+5
  • Intercom Team
  • 230 replies
  • Answer
  • December 2, 2024

Hey ​@Dhrupad Purohit 👋 I see you got in touch with the team via the Messenger and gotten this resolved 💬✅

 

For anyone else facing this issue - background mode push notification capabilities from Xcode needed to enabled along with some changes in AppDelegate.swift file, like below:

 

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Intercom.setDeviceToken(deviceToken) NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken) }

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error) }

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { NotificationCenter.default.post(name: Notification.Name.init("didReceiveRemoteNotification"), object: completionHandler, userInfo: userInfo) }


For more information on iOS Push Notifications, you can check out our Developer Documentation here 📌


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings