Running Your iOS Application on an iOS Device
Go Up to iOS Mobile Application Development
You can run your Delphi or C++ iOS app on an iOS device only after you have successfully completed the following steps:
- Configure your development environment for iOS application development.
- Create a development provisioning profile for your application.
- Complete the Provisioning page for the Development platform configuration.
The following is a conceptual illustration of the iOS development process, including the connection to an iOS device:
Contents
Steps to Run Your App on an iOS Device
- Run the Platform Assistant on the Mac.
- Test the connection to your Mac (on the Connection Profile Manager page).
- Connect an iOS device (such as an iPhone or an iPad) to your Mac using the Apple standard USB cable (illustrated on the right).
- Note: Your iOS SDK version does not need to match the iOS device version. You can use the latest version of the iOS SDK and run your application on older iOS versions that RAD Studio supports. You should always use the latest version of the iOS SDK version.
- In RAD Studio:
- In the Projects Window, expand the Target Platforms node and double-click the iOS Device - 64 bit target platform. The selected target platform is displayed using a bold font.
- In the Target Platforms node, expand the selected iOS device node, expand the Configuration node, and double-click the Development platform configuration to select it. The selected platform configuration is displayed using a bold font.
- Note: You cannot run applications directly from RAD Studio into an iOS device if you build them with the Application Store platform configuration. To run apps built for the App Store, you must submit them to the App Store and install them from the store.
- Run your app, either with debugging (Run > Run) or without debugging (Run > Run Without Debugging).
RAD Studio builds your app using the SDK that you previously added to the IDE, connects to your Mac using the connection profile that you configured for the selected iOS device target platform, and the Platform Assistant on the Mac launches your application on the connected iOS device.
- Notes:
- The first time that you use a user account on your Mac to run an application on an iOS device, your Mac will prompt you to allow RAD Studio to sign applications using your private key. You must accept this on your Mac so that RAD Studio can continue running your application on your iOS device.
- RAD Studio might look frozen at some points until it launches your app on your iOS device, but it is just preparing to run your app.
Running Your Application with Clean Data and Cache Folders
When you run an application on an iOS device, RAD Studio installs your application on your device using the CFBundleIdentifier
value that you defined in the Version Info options page to uniquely identify your application. By default, the CFBundleIdentifier
value is "$(ModuleName)", which is the name of your project, such as "Project1".
If you run your application on a device that already contains a previously-installed application with the same CFBundleIdentifier
value as the application that you want to run, the Run command reinstalls your application, but only updates the application executable; the data and cache folders of your application are not updated.
To configure RAD Studio so that the Run Without Debugging and Run actions completely uninstall any previously-installed version of your application, including the data and cache folders, before installing the newer version:
- Select Run > Parameters.
- Enter "-cleaninstall" in the Parameters field:
- Click OK to save your changes.
Troubleshooting
For 'Device connection timeout,' please connect your iOS device to your Mac
If your iOS device is not connected, you see the following message in the IDE after you attempt to launch your app on an iOS device:
Device connection timeout
If you see this message, do the following:
- Dismiss the message.
- Connect your iOS device to the Mac using an Apple USB cable (shown above).
- Run your app again from the IDE. See the steps given above.
- Note: The PAServer command-line utility allows you to set a device connection timeout using the
-devicetimeout=<n>
. However, setting a different device timeout value does not solve the problem in the case of a missing iOS device.
'Unable to locate DeviceSupport directory matched with connected device info'
If you have recently upgraded the iOS version of your device, you might get the error message above when you try to run your app on your iOS device. If you see this message, do the following:
- Dismiss the message.
- On the Mac, open Xcode.
- Select Window > Organizer and determine whether Xcode recognizes your device:
- If Xcode recognizes your device, let Xcode re-import your device support information, and try running your application from RAD Studio again.
- If Xcode does not recognize your device, you must upgrade Xcode.
- Note: Alternatively, if Xcode does not recognize your device, but you do not want to upgrade Xcode in your Mac, you may try connecting your device to a different Mac which does have an upgraded version of Xcode that recognizes your device. After you let a newer version of Xcode re-import your device support information, an older version of Xcode might recognize your upgraded iOS device as well.
Nothing Shows Up in the iOS Device
If after you follow the steps to run your app on an iOS device, the app does not show up in your iOS device, check the following:
- The Platform Assistant must be running on the Mac. See Running the Platform Assistant on a Mac:
- On RAD Studio, the connection profile associated with the selected iOS device target platform (iOS Device - 64 bit) must connect with the target instance of the Platform Assistant.
- See Activating and Configuring the Target Platform for instructions on how to configure the connection profile associated with an iOS device target platform in your project.
- On the Tools > Options > Environment Options > Connection Profile Manager page:
- Select the connection profile associated with the selected iOS device target platform from the left-hand column (which lists the available connection profiles, grouped by platform).
- Check the values of that connection profile, such as the IP address (it must be the IP address of your Mac) and the port number (it must be the port number of the Platform Assistant).
- Click Test Connection to ensure that your development PC has a working connection to the Platform Assistant that is running on the Mac.
My App Does Not Stop at Breakpoints Anymore
After a crash during a debugging session on an iOS device, it might happen that the next debugging sessions do not work anymore on your iOS device.
If when you run with debugging symbols your application runs but never stops at any breakpoint, do the following:
- On your Mac, launch Xcode.
- On Xcode, create a new iOS application.
- With your new Xcode iOS application open, select iOS Device as your target.
- Click and hold Run, and select Analize from the context menu that appears.
You can now close Xcode and continue using your iOS device to debug RAD Studio applications.
[DCC Error] E2597 ld: file was built for armv7
[DCC Error] E2597 ld: file was built for armv7 which is not the architecture being linked (arm64): C:\Users\<user>\Documents\Embarcadero\Studio\SDKs\iPhoneOS7.0.sdk/usr/lib/libiconv.dylib for architecture arm64
This error occurs when you try to build an application for the iOS Device - 64 bit target platform using the 7.0 version of the iOS SDK. RAD Studio does not support versions of the iOS SDK lower than 8.0. Make sure that you have the latest version of Xcode installed on your Mac, and add a supported iOS SDK to RAD Studio.
Synchronizing the Xcode with Your iOS Device
You need to ensure that the Xcode that is installed in the Mac supports the iOS version of the iOS device, and that they are synchronized. You can follow these steps to synchronize the Xcode in the Mac and your iOS device:
- Unplug your iOS device from the Mac.
- Open Xcode on your Mac.
- From the main menu, select Window, Devices.
- Attach your iOS device back to the Mac.
- On the Devices window, select your iOS device on the left-hand side of the window.
- Wait for the loading wheel to disappear. When it does, you can close Xcode and try to debug your application again.
My App Crashes
Your application may crash on your iOS device if you build your application with a version of the iOS SDK that is higher than the version of iOS that your device is running. For example, if you build your application using version 9 of the iOS SDK, and you run your application on a device running iOS 8, your application might crash. If this is the case, change the iOS SDK that RAD Studio uses to build your application for iOS.