Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you receive FCM push notification from iOS simulator?

I have recently started iOS development, and was trying to build a simple web based iOS application with push notification feature using Firebase. I have tried about 3 tutorials about sending push notifications using FCM, including the one from official document, yet I could not receive any notifications from my iOS simulator. At this point, I am wondering if iOS simulator from xcode is not capable of receiving cloud messaging.

ps. I haven't tested with physical iOS device. (I don't have one yet)

like image 564
IChung Avatar asked Sep 13 '25 16:09

IChung


2 Answers

After Xcode 11.4 it is possible, but for firebase messaging it requires gcm.message_id value to be present. Otherwise it won't be handled by firebase SDK.

{
  "Simulator Target Bundle": "<your bundle>",
  "aps": {
    "badge": 0,
    "alert": {
      "title": "Test Push",
      "body": "Success! Push notification in simulator! 🎉",
      "sound": "default"
    }
  },

  "gcm.message_id": "123",
  "example-data-key": "example-data-value"
}
like image 134
Orkhan Alikhanov Avatar answered Sep 15 '25 05:09

Orkhan Alikhanov


Sorry to say, but you'll need to find some hardware to test this functionality.

Push notifications are not available in the simulator. They require a provisioning profile from iTunes Connect, and thus are required to be installed on a device. That also means you'll probably have to be accepted into the apple iPhone developer program and pay your $99.

How can I test Apple Push Notification Service without an iPhone?

like image 20
abh Avatar answered Sep 15 '25 05:09

abh