Featured Image
Software Development

Trigger notification on iOS Simulator from the Flutter project

In the field of app development, ensuring a smooth user experience is paramount. This often involves incorporating push notifications, a key feature that keeps users engaged and informed. For Flutter developers, this presents a unique challenge. Basically, the iOS simulator does not show the push notifications from the Firebase, unlike its real-device counterpart.

However, there is a straightforward workaround that allows you to bypass this limitation and test notifications on the iOS simulator by following some simple steps.

Steps to Display iOS Simulator Push Notifications from Firebase:

  • The iOS app needs notification permission to be allowed to show any kind of notification.
  • You can use any third-party plugin to ask for notification permission on iOS.
  • Put the below JSON in assets/payload.json
{
 "aps": {
   "alert": {
     "title": "Notification title",
     "subtitle": "Notification subtitle",
     "body": "Notification payload"
   }
 }
}
  • Add below code snippet in the pubspec.yaml
flutter:
 uses-material-design: true

 assets:
   - assets/
  • Run the flutter pub get command
  • Run the app and then a notification permission alert will pop up on the simulator. Allow it to enable notifications.
  • Then open the terminal on project space and hit the following command with replacing your packageName.
xcrun simctl push booted packageName assets/payload.json

Yeah!! That’s it. After following the above steps, you should be able to receive the notifications on your iOS Simulator. This method not only saves time but also bridges the gap between development and real-world application.

Do you need help with your projects? At Aubergine Solutions, we offer expert Flutter app development and custom iOS App Solutions that bring your ideas to life with beautiful, cross-platform apps. Our team of seasoned developers and designers is at the forefront of innovation, ensuring your app not only functions seamlessly but also stands out in the crowded digital space. Contact us today.

  If you enjoyed this read, then also explore our other posts:

 Maximizing Revenue in Flutter Apps: The Ultimate In-App Purchase Guide

Adding Augmented Reality to Your Flutter Projects

Upgrading Your Flutter SDK to the Latest Version

Dart or Kotlin for App Development?

Notification on iOS Simulator
author
Nayan Babariya
Senior Flutter Engineer specializing in cross-platform mobile application development using the Flutter framework. I excel at building high-quality, scalable apps and digital solutions.