This is Part 2 of a 2-part article on incorporating support for FCM in your Delphi apps for Android and iOS, and this part covers implementation on iOS.

Issues with later versions of the Firebase SDK: For those who are having compile issues with later versions of the SDK, I’m working on resolving the problems. Meanwhile, earlier versions of the the SDK may be downloaded using a URL in this format:

Where x, y, and z relate to the version number, so for version 4.3.0 the URL is:

FireDAC SQLite issue: Thanks to Steven Chesser who found this issue, and to Dmitry Arefiev for coming up with a solution:

If you’re using FireDAC with SQLite in your app, you’ll likely find that the app crashes on startup. It appears that FireDAC binds to SQLite static libraries that are incompatible with FCM. To alleviate this issue, please follow these steps:

  1. Make a copy of from the C:\Program Files (x86)\Embarcadero\Studio\xx.0\source\data\FireDAC folder, and put it in your project folder (where xx is the number for your Delphi install e.g. 18 for Delphi 10.1 Berlin)
  2. Modify to change the line:
    Remove the “.” after the “{” so that it becomes:
  3. In Project Options, select: All configurations – iOS Device- 64 bit platform, and add the following to the search path:
  4. Clean and Build the project (as opposed to Compile), run it, and all should be OK

If you haven’t done so already, please read at least step 1 of Part 1, because it has important information about how to retrieve the .plist file that’s required for your iOS app, and about the starter project.

This article assumes that you have a certificate, app id and provisioning profile set up already, and added to your Mac. If you do not, please refer to this article.

Let’s start!

1. Download the Firebase SDK from the Firebase site

Go to the Firebase iOS setup page, navigate to the “Integrate Without Cocoa Pods” section (since we’re not using Cocoa Pods) and click the link in step 1 to download the SDK. Extract it somewhere appropriate that’s common to your applications. Inside, you’ll notice a a bunch of folders, and inside each folder is one or more “framework” folders (they have an extension of “.framework”). Inside each of those, in the root, is a file with the same name, with no extension. These are the binaries that your app needs in order to use the Firebase SDK.

2. Add paths to the framework files in your Delphi project

The easiest way to make it so that the compiler can find the files is to add a path for each of the necessary frameworks. In the Project Options for your Delphi project, select Delphi Compiler in the tree, and select All configurations – iOS Device – 64 bit platform in the Target combo box. In the Search Path option, you’ll need to add a path for each of the following (where <firebase> is the root of the Firebase SDK that you extracted):


While we’re in the Project Options, you’ll also need to add a parameter to the Linker options. Under Delphi Compiler, select Linking, and add -ObjC to the “Options passed to the LD linker” option (as per part 3 of the SDK requirements for apps not using Cocoa Pods on the Firebase iOS setup page):

You’ll need to repeat the above for iOS Device – 32 bit platform when you’re ready to deploy to the App Store or Test Flight, unless Apple has removed the 32-bit requirement by then.

Go to the Version Info section of the Project Options and modify the CFBundleIdentifier field so that it matches the identifier for your App ID on the Apple Developer site:

Then go to the Provisioning section, just to make sure the certificate and provisioning profiles have been found, and click OK.

3. Add the required frameworks from the iOS SDK to the Delphi SDK Manager

If you’re not already familiar with how to add other frameworks to the iOS SDK, you can refer to this article. You’ll need to add each of the following frameworks:


Note that the case of the name is very important! (eg it’s CoreMIDI, not CoreMidi). Remember to click Update Local File Cache when you are done adding those, and remember to click OK.

4. Add GoogleService-info.plist to the deployment

In Delphi, click Project, Deployment and select All configurations – iOS Device – 64 bit platform in the combo. Click the button with the white rectangle and green “+” on it to add, then select your GoogleService-info.plist file and click Open, e.g:

Now: would you believe that is it? Other than compiling and running your project, that is. While Monitor is good for watching log messages on Android, on iOS I find iOSConsole to be a decent equivalent on iOS, and it doesn’t require you to start Xcode. If you download that (onto your Mac), install and run it, you’ll be able to see the log messages for the starter project. Put the text “FCMStarter” (without the quotes) in the filter box of iOSConsole.

Run the app, and the first time you do, you’ll be prompted as to whether you would like the app to receive notifications. Be sure to tap “Allow”! You should also see the token appear in the upper memo. The token will also appear in the iOSConsole window:

Just like in Android’s Monitor app, you can copy the lines in iOSConsole, and extract the token from the copied text.

For iOS, FCM messages need to be of the notification format, e.g:

[sourcecode language=”javascript”] {
"to": "(yourtoken)"
"notification" : {
"body" : "Congratulations, you received a message",
"title" : "Firebase Cloud Messaging rules!",
"badge": "0"

Where (yourtoken) is the one you retrieved from the log.

Please refer to the last step of the previous article where I mention how to use Hurl to send test messages. If you’re using the starter project, you should check that notifications appear in the memo on the main form when the app is running, and for all apps using this framework, notifications will appear in the notification center when the app is in the background, or not running at all.

That’s all on this subject for the moment. There may be follow-up articles as to how to go about using the SubscribeToTopic and UnsubscribeFromTopic methods, and further developments going forward.