iOS 8.1.3 app deployment steps for RAD Studio XE7

Posted by on in Blogs
An iOS 8.1.3/8.2 Deployment Beta Hotfix is available for registered XE7 users:

Note: The steps below should also work for iOS 8.2. Please use option C with iOS 8.2.

If you just updated to iOS 8.1.3 and have been getting the 'Unable to install package. (e800003a)' error when deploying a Delphi, C++Builder or RAD Studio XE7 application to an iOS 8.1.3 device, here are the steps to resolve this issue. Please note that the instructions will vary depending on your Team ID and App ID, so see Option a and b below to determine which steps to follow.

These steps should also work if you own Delphi, C++Builder or RAD Studio XE6.

Note: If you have an existing iOS project that you've previously built for an iOS device, you should delete the 'Entitlement.TemplateiOS' file found in the project's directory. In addition, you should also delete the existing iOS project entitlement file in your iOS Device or iOS Simulator Debug and/or Release folders. This will ensure that the changes you are going to make following the steps below will apply to existing and new projects.

Option A:

Follow these instructions if your Team ID and App ID are the same. This is often the case for individual developer accounts.

  • Open RAD Studio XE7

  • Go to File->Open, type %AppData% into the File Name field and click Enter

  • Browse to Embarcadero\BDS\15.0 and select Entitlement.TemplateiOS to open the file in the IDE

  • Go to your Mac and open Keychain. You can find Keychain by searching for it using Spotlight on the Mac.

  • Once Keychain is open, select your iPhone Developer certificate (in my case it is iPhone Developer: Sarina DuPont (xxxxxxxx). The xxxxxxxx will show your own unique identifier.

  • Right-click on your iPhone Developer certificate and select 'Get Info'. The Organizational Unit identifier will be needed in the next steps.

  • Return to the IDE and add the two lines as shown in the screenshot below to your entitlement file. Replace OrganizationalUnit with the unique identifier from your iPhone Developer certificate on your Mac (Step 6).

  • Save the .xml file and you should now be able to deploy RAD Studio XE7 applications to your iOS device again.


Note: If you continue to have problems, we recommend that you clean your iOS Device/Debug directories in case there is an old file there that is causing problems.

It is recommended to edit the Entitlement.TemplateiOS.xml file in the IDE. This file cannot contain any carriage return line feeds and must contain line feeds only. The editor in the IDE will look at the previous line to determine the next line's line break so that the line feed only terminators will remain intact. Do not use anything like Notepad as this is not the case in all editors.



Option B:


If the steps above did not work for you, it means that your App ID Prefix is different from your Team ID. Please see the steps below to resolve the issue.


  1. Open RAD Studio XE7

  2. Go to File->Open, type %AppData% into the File Name field and click Enter

  3. Browse to Embarcadero\BDS\15.0 and select Entitlement.TemplateiOS to open the file in the IDE

  4. Go to developer.apple.com and sign in to your iOS Developer Program

  5. Under Provisioning Profiles | Development, select the iOS Provisioning Profile that you are using, and find the App ID for that iOS Provisioning Profile. For example:

  6. Under Identifiers | App IDs, find the App ID which is displayed in Step 5 and select it. Get the
    Prefix and the ID that are displayed.  If the ID field is just a *, you can just use the prefix. For example:

  7. Return to the IDE and add the two lines as shown in the screenshot below to your
    Entitlement.TemplateiOS.xml file. Replace AppIDPrefix.ID with the Prefix and ID from the previous step:

  8. Save the .xml file and you should now be able to deploy RAD Studio XE7 applications to your iOS device again.


It is recommended to edit the Entitlement.TemplateiOS.xml file in the IDE. This file cannot contain any carriage return line feeds and must contain line feeds only. The editor in the IDE will look at the previous line to determine the next line's line break so that the line feed only terminators will remain intact. Do not use anything like Notepad as this is not the case in all editors.



Option C:

The steps below are designed to help resolve the iOS 8.1.3 deployment issues if Option A and B did not work for you.
Note: This will require you to make the changes at the project level and create separate versions of the entitlement file depending on your desired configuration (i.e. Debug vs. App Store vs. Ad-hoc).

1.    Browse to the mobile provisioning profiles on your Mac. Note: If you have more than one, you may want to go back to developer.apple.com, login to your account, and download the one you want to use to simplify the provisioning profile selection process
2.    There are two ways of accessing the provisioning profiles. You can browse to them using Finder on the Mac or using Terminal

a) Using Finder:

  1. On your Mac, browse to User/Library/MobileDevice/Provisioning Profiles

  2. Select the Mobile Provisioning Profile you want to use

  3. Open it in a text editor on your Mac such as TextEdit

  4. Select the Entitlements section between the <dict> tags

  5. Copy the contents to your clipboard (command + C)


b) Using Terminal

  1. On your Mac, open Terminal

  2. Type cd and hit Enter

  3. Type cd Library/MobileDevice/Provisioning\ Profiles/ and hit Enter

  4. Type ls and hit Enter to get a list of all of your provisioning profiles

  5. Select a provisioning profile from your list and copy the name

  6. Type  security cms -D -i provisioning-profile-uuid.mobileprovision > MyProvisioningFile.txt and hit Enter

  7. Search for MyProvisioningFile.txt (it will be located in the same folder as your Provisioning Profiles)

  8. Select the .txt file and copy it to your Windows machine

  9. On Windows, open RAD Studio and open the text file

  10. Select the Entitlements section between the <dict> tags

  11. Copy the contents to your clipboard


3.    Create a new multi-device project (or open your existing multi-device project) in RAD Studio XE7. Make sure to save the project in a project specific folder, i.e. C:/MyMultiDeviceApp.

Note: If you have an existing iOS project that you’ve previously built for an iOS device, you should delete the ‘Entitlement.TemplateiOS’ file found in the project’s directory. In addition, you should also delete the existing iOS project entitlement file in your iOS Device or iOS Simulator Debug and/or Release folders. This will ensure that the changes you are going to make following the steps below will apply to existing and new projects.
4.    Select iOS Device by double-clicking on the Target Platform
5.    Go to Project->Build and wait until the build process is done
6.    Browse to your project folder (i.e. C:/MyMultiDeviceApp) and open the Entitlement.TemplateiOS.xml file in the IDE
7.    Replace the code between the <dict> tags with the contents from your clipboard (that you copied from your mobile provisioning profile)
Make the changes as shown below. Please note that the entries in your entitlement file may differ from the example below:

<key>keychain-access-groups</key>
<array>
<string>PREFIX.*</string>       // replace this value with the final key value of <key>application-identifier</key>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>PREFIX.ID</string>
<key>com.apple.developer.team-identifier</key>
<string>TEAMID</string>

Note:  PREFIX is XXXXXXXXXX
a) If ID value is   * , then you can replace * with com.yourcompany.projectname
b) If ID value is   com.yourcompany.* , then you can replace * with the project name, so it becomes com.yourcompany.projectname
c) If ID value is  com.yourcompany      , then you leave the value as is

8. After you have made those changes, save the entitlement.xml file to your project’s directory. It is a good idea to give this entitlement .xml file a name that is reflective of your provisioning profile type, such as AdHocEntitlement.xml.

Note: You will need to repeat these steps for each configuration such as Debug, App Store and Ad-Hoc since they all have different iOS Mobile Provisioning Profiles.

9.  Go to Project->Options->Version Info.
10. Replace $(ModuleName) with the final ID value of application-identifier from step 7. For example, com.yourcompany.projectname



11. Save your project
12. You can now build your project for the configuration associated with your provisioning profile (Debug/App Store/Ad-hoc).
13. To simplify the deployment of additional entitlement files specific to your configuration, right-click on your project to define a new configuration such as Adhoc:


14. If you want to inherit off of Debug or Release, you can right-click on Debug or Release to create your custom configuration based on that configuration:



15. Activate your new configuration by double-clicking on it. Then set the iOS Device configuration to the same setting, i.e. Adhoc



16. Add your custom entitlement file to the deployment manager by going to Project->Deployment
17. Uncheck the default Entitlement file, then click on the plus icon to add your Adhoc entitlement file (i.e. AdHocEntitlement.xml)
18. Change the Remote Name of your newly added entitlement file so that it matches the name of your original file, i.e. Project7.entitlements. This is important since it will expect a file with that filename. Also make sure that you have correct configuration selected from the drop-down menu in the deployment manager.



19. Save the project and build for your selected target.

We are planning to release an XE7 hotfix for this issue in the future.


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

Comments

Check out more tips and tricks in this development video: