Steps for building iOS 32-bit applications for iOS 9 with XE7 and XE8

by Sep 17, 2015

With RAD Studio 10 Seattle, you can build apps that run on iOS 9.

A change in the iOS SDK is causing deployment issues on iOS 9 for 32-bit iOS applications built with XE7 and XE8. This is not an issue with RAD Studio 10 Seattle. 

Below are some simple workaround steps for building iOS 32-bit applications for iOS 9 with XE7 and XE8. 

This does not impact iOS 64-bit applications or Universal binaries built with XE8 that were deployed to 64-bit iOS devices or any iOS applications built with 10 Seattle.

As you might know, iOS applications submitted on the Apple App Store must be submitted as either Universal binaries (with both 32-bit and 64-bit support) or 64-bit only applications. Most iOS devices released in the last couple of years are 64-bit devices. RAD Studio XE8 and RAD Studio 10 Seattle provide support for building 64-bit iOS applications.

Steps for building iOS 32-bit applications for iOS 9 with XE7 and XE8:

Step 1: Open your existing iOS project in RAD Studio XE7 or XE8

Step 2: Browse to the sourcefmx directory of your RAD Studio installation and locate the FMX.Context.GLES.iOS.pas unit.  

Step 3: Copy this file into your project folder, keeping the original source file intact. 

Step 4: Add the unit to your project. 

Step 5: Open FMX.Context.GLES.iOS.pas in the code editor in the IDE.

Step 6: In the function TCustomContextIOS.CreateSharedContext, there is a line of code which assigns the FSharedContext field. In XE8 and XE7, it is line 52. It looks like this:

FSharedContext := TEAGLContext.Wrap(TEAGLContext.Create.initWithAPI(kEAGLRenderingAPIOpenGLES2));

Change the word "Create" to "Alloc". 

The fixed version should look like this: 

FSharedContext := TEAGLContext.Wrap(TEAGLContext.Alloc.initWithAPI(kEAGLRenderingAPIOpenGLES2));

Step 7: Save the file and rebuild your project using the iOS 8.4 SDK. You can target an iOS 9 device but you must build against the iOS 8.4 SDK.

 

Note: To build your project against an iOS 8.x SDK, right-click on the iOS Device – 32 bit Target Platform in the Project Manager. Select “Properties…”. 

In the SDK drop-down menu, select the iOS 8 SDK, i.e. iPhoneOS 8.4. Then hit “OK”.  

If you deleted the iOS 8.4 SDK from the IDE, you will need to connect to your Mac with Xcode 6.4 installed and re-add it to your IDE. 

You can add the SDK through the IDE by right-clicking on the iOS Device – 32bit Target Platform in the Project Manager and selecting “Add New…” from the SDK drop-down menu. 

If your iOS device has iOS 9 installed, you will need to update Xcode on your Mac to the latest version of Xcode which is Xcode 7. When building your iOS application for the device (debug), Ad-Hoc or App Store, you will need to build against the iOS 8.4 SDK. 

If you no longer have the iOS 8 SDK installed on your Mac, you can download it by going to developer.apple.com (requires that you have an active Apple developer account).