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

Posted by on in Tools

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). 

  

About
Gold User, Rank: 5, Points: 558
Senior Product Manager, RAD Studio

Comments

  • Ramon H9903
    Ramon H9903 Saturday, 05 March 2016

    Very helpful. This solved my problem instantly. I use XE8 + iOS 9.2.1 on an iPad mini model A1432.

  • Simon L2068
    Simon L2068 Friday, 09 October 2015

    Hi all,
    I'm using Seattle Delphi 10, XCode 7, have both 8.4 SDK + 9.0 SDK, targeting 8.4 + 9.0, have patched PA17 and compiling Universal Binary.
    I deployed both 8.4 (& again 9.0) SDKs on TestFlight, downloaded and got identical results:-
    Startup ok on 64-bit 5S but on 32-bit 4S, I get splash screen and close immediately.
    Should I downgrade to XCode 6.4 as per Ruben's advice?

  • Ruben Dorrego (Touche Software)
    Ruben Dorrego (Touche Software) Friday, 09 October 2015

    Once you downgrade to 6.4 and works with 8.4 SDK everything works fine with your app for every version of iOS. I expect it will be fixed in next RAD Studio update.

  • Simon L2068
    Simon L2068 Friday, 09 October 2015

    yah... and we'll probably have to uninstall seattle and reinstall update 1 all over again coz there are just too many crawling around :P
    thks again :D

  • Albert V8498
    Albert V8498 Tuesday, 06 October 2015

    Hi Ruben. Thank you for your reply it is exactly the info I needed. Apple took forever and a day to approve it but worked first time. Much appreciated!!

  • Lee P8553
    Lee P8553 Wednesday, 30 September 2015

    Hi Sarina

    Re: Delphi XE7 Ent

    Sorry if this sounds like a stupid question, where is the file FMX.Context.GLES.iOS.pas stored??

    Thanks

    Lee

  • Sarina D
    Sarina D Wednesday, 30 September 2015

    The source file can be found in C:\Program Files\Embarcadero\Studio\16.0\source\fmx

  • Lee P8553
    Lee P8553 Monday, 05 October 2015

    Hi Sarina
    Windows 7 / DElphi XE7

    Having checked the folder C:\Program Files (x86)\Embarcadero\Studio\15.0\Source it only contains the folder DUnit. No fmx folder exists!!

    Cheers

    Lee

  • Lee P8553
    Lee P8553 Monday, 05 October 2015

    Hi Sarina
    On further checks, Ive gone into Options->Delphi Options->Library->Browsing Paths. This lists many $(BDS)\Source folders. However that are all grey, since they do not exist!!!

    Lee

  • Russ P8527
    Russ P8527 Wednesday, 30 September 2015

    Lee, the .pas file is stored in the same directory as the project.

  • Russ P8527
    Russ P8527 Tuesday, 29 September 2015

    Currently having issues with XE7 development on an IOS9 device.
    I have followed your instructions and I am using the following:
    MAC : Xcode 7
    SDK 8.4
    Modified FMX.Context.GLES.IOS.pas as instructed.
    I have created a simple project with a form and a button
    this is the error I get during once it attempts to run the app:
    "Unable to install package e800003a"
    Any ideas as to what i am doing wrong?
    Thanks

  • Russ P8527
    Russ P8527 Thursday, 01 October 2015

    thanks you, problem solved. It was an old entitlement.ios file that was in my project directory. deleting it then re-deploying solved the problem.

  • Albert V8498
    Albert V8498 Friday, 25 September 2015

    Also you say 'download 8.4 from apple website'. I am logged in as developer there and can not find anywhere to get 8.4. I only have IphoneOS9 available after upgrading xcode

  • Ruben Dorrego (Touche Software)
    Ruben Dorrego (Touche Software) Saturday, 26 September 2015

    Maybe I could help you, since I had same issue. Login in Apple Developer and go to this link: https://developer.apple.com/downloads/ You need to uninstall XCode 7 and install XCode 6.4 and Command Line Tools for XCode 6.4 and you will get the SDK 8.4 that you can use in Delphi XE7,XE8 or XE10.

  • Simon L2068
    Simon L2068 Friday, 09 October 2015

    Ruben: what is the safest way to uninstall XCode 7?

  • Ruben Dorrego (Touche Software)
    Ruben Dorrego (Touche Software) Friday, 09 October 2015

    To uninstall Xcode, just open the Finder, select Applications and drag and drop Xcode folder to the trash icon. If you download and install Xcode 6.4 be sure to also install the Command Line Tools for Xcode 6.4.

  • Simon L2068
    Simon L2068 Friday, 09 October 2015

    thanks for your quick reply. Will try out tomorrow as its getting late. Lost 2 working days fretting over this.

  • Albert V8498
    Albert V8498 Friday, 25 September 2015

    I have XE8 and have active ios apps. on IOS9 they all crash. So I updated to latest Xcode 7 and now xe8 wont even pick up my target devices in the simulator nevermind actually run to any ios device.

    Can you give some feedback on the exact versions of what that one need for this to work. I purchased XE8 2 months ago, can not afford to upgrade to XE10 already. surely it still has to be able to work??

  • Sarina D
    Sarina D Monday, 28 September 2015

    Hi Albert,

    If you are using XE8 and want to build an app that runs on iOS 8 and iOS 9, you will need to target the iOS 8.4 SDK. Make sure you have Xcode 6.4 installed.

    You can access previous versions of the SDK and Xcode by logging into your Apple developer account (requires that you have an active Apple developer account). You can navigate to Downloads from there to access older versions.

    Regards,
    Sarina

  • Albert V8498
    Albert V8498 Tuesday, 06 October 2015

    Thanks, got it to work and is approved and working like a charm now :)

  • Please login first in order for you to submit comments