Before the release of Delphi 10.3.2, Embarcadero released a patch for including FCM (Firebase Cloud Messaging) for Android in your apps, and now that support is included in Delphi 10.3.2. This article describes how to include support for iOS in FCM.
UPDATE: With many thanks to Antonello Carlomagno, the iOS implementation now has been tested more, and fixes applied as a result. Please update the demo files so that your iOS app will now receive events whilst the app is in the foreground or background.
TL;DR – The demo for including iOS in FCM is here. Note that it depends on other files in Kastri Free.
This solution is based around existing code that is used in my FCM solution, presented here. I created a unit (DW.PushNotification.iOS) which is similar to FMX.PushNotification.Android, that is meant as a “replacement” of sorts for FMX.PushNotification.iOS.
This new push notification unit uses other units from Kastri Free to provide the necessary implementation for iOS. It also relies on framework files from the Firebase 6.2.0 iOS SDK, however those that are required are also part of Kastri Free. The key things to remember for iOS when you’re including it in your own project are:
- Add GoogleServices-info.plist (download it from your project in Firebase Console) to your deployment (use a Remote Path of ./)
- Include -ObjC in the “Options passed to the ld linker” setting in the Linking options, which is under Building\Delphi Compiler in the Project Options. You’ll soon know if you’ve missed this because your app will crash on startup.
- Include paths to the Firebase SDK frameworks (these are in the Search path in the Project Options of the demo for iOS Device 64-bit configuration)
Go here for information on how to configure your app for FCM for Android.
As described above, the demo for this solution can be found here. It has had fairly minimal testing, so if you have any issues, please report them here.