Fix: iOS 17 / XCode 15 for Delphi 11.3
Two recent issues have risen once XCode has been updated to 15.0.1 while using Delphi 11.3 to update your mobile application. There are two fixes to add to support iOS 17 and the changes for XCode after updating: (1) updating your SDK on XCode, since the update removes the iOS Simulator and SDK; and (2) patching the RootViewController initialization of the WindowManager for the PlatformCocoaTouch on iOS.
First, we are going to make sure you have the iOS SDK installed for Mobile development. We will do so by following the next steps:
Run XCode
Go to XCode > Settings...
Select the Platforms tab
If the iOS 17.0 entry is missing showing a GET button, click on the GET button! Otherwise, if it shows in blue icon as the screen shot below, then you have it set up accordingly.
Once the steps are followed you should be all set.
Last, we are going to patch the file in FMX.Platform.iOS.pas. Go to the following folder "C:\Program Files (x86)\Embarcadero\Studio\22.0\source\fmx", this is the default installation folder for your Embarcadero, RAD IDE as shown in the image below.
Next, copy the file to your local projects folder, and add it to your project. Go to line 1526, and modify the following section:
// Creating window
WindowManager := PlatformCocoaTouch.WindowManager;
WindowManager.Window := TFMXWindow.Create(MainScreen.bounds);
WindowManager.RootViewController := TFMXViewController.Create;
WindowManager.NativeWindow.makeKeyAndVisible;
To the following for the iOS fix.
// Creating window
WindowManager := PlatformCocoaTouch.WindowManager;
WindowManager.Window := TFMXWindow.Create(MainScreen.bounds);
WindowManager.RootViewController := TFMXViewController.Create;
// *** Start of iOS17 SDK crash issue - Add the following line: ***
WindowManager.RootViewController.Super.init;
// *** End of iOS17 SDK crash issue ***
WindowManager.NativeWindow.makeKeyAndVisible;
These simple fixes should allow you to address the issues for cross-compiling and building your application for iOS after updating to the latest version of XCode, in this case, 15.0.1.
References
https://www.reddit.com/r/delphi/comments/16r7l68/delphi_app_crashing_on_device_running_ios_17/
Subscribe to my newsletter
Read articles from Alessandro directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Alessandro
Alessandro
I am a developer from the Greater Boston area, I have a M.S. in Computer Science and Engineering from the University of Connecticut, focused on Bayesian Networks and Bayesian Knowledge Bases. I have experience working on 3D laser scanners, motion platforms, DARPA projects, 3D simulations using the Unity game engine for robotics in synthetic environments (game generated and scanned), mobile development in both Android and iOS. My strengths are in rapid prototyping and taking an idea into a release candidate. The process is a winding road that takes a lot of time