简体   繁体   中英

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)

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?

You can simulate push notification in Xcode 11.4-beta and above.

Steps:

  1. Download and install Xcode 11.4-beta and above.
  2. Create a sample app that requests for permission to receive push notifications.
  3. Run the sample app and grant it permission.
  4. Put the sample app into the background.
  5. Create an Apple Push Notification Service (APNS) payload file.
  6. Drag and drop the payload file onto the target simulator.

Read this article for detailed info: https://medium.com/swlh/simulating-push-notifications-in-ios-simulator-9e5198bed4a4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM