Featured Image
Software Development

Trigger notification on iOS Simulator from the Flutter project

Basically, the iOS simulator does not show the push notifications from the firebase. There is a workaround to test notifications on the iOS simulator by following some simple steps.

Steps:

  • 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 doing this, you should be able to receive the notifications on your iOS Simulator.

Notification on iOS Simulator

If you need expert developers for Native iOS development that are familiar with Agile project execution, please reach out to us at hello@auberginesolutions.com.


If you are an iOS Engineer and would like to work on similar cool stuff, please apply to our open positions at https://www.auberginesolutions.com/careers

author
Nayan Babariya
A Senior Flutter Engineer with specialization in the Flutter framework for building cross-platform mobile applications. I have a strong understanding of the Flutter ecosystem and am able to use its various features and tools to build high-quality, scalable, and maintainable apps.