Ranorex Help Center How can we help you?

Instrumentation with Source Code on iOS

Instrument and Deploy your iOS app

First you have to instrument your iOS app.

Note It's recommended to fresh instrument your app for every new Ranorex release. For further information have a look at the section 'Mobile Testing - Versioning'.


This can be done by either following along with the video instructions or by following the textual description below.


Opening XCode project and add a new target

Opening XCode project and add a new target

Adding the necessary libraries to the XCode project

Adding the necessary libraries to the XCode project

Modifying linker flags and building a project.

Modifying linker flags and building a project.




Note The file size of Ranorex Automation Library is about 30 megabytes. This doesn't automatically make your app 30 megabytes bigger, since it is a universal library and only the parts essential for your app will dynamically be added when compiling it.



  • Open the XCode project of your application under test.

    Open *.xcodeproj file

  • In order to avoid shipping an instrumented app to your customers it is recommended to create a separate target for your app under test. You should select the project file and duplicate the existing target.
    Duplicate Target

    Duplicate Target

  • Rename the newly created target.
    Rename duplicated target

    Rename duplicated target

Note As XCode does not automatically update all necessary files, you have to rename them manually. You will have to alter the target itself, the targets .plist file (in workspace as well as in Build Settings -> Packaging), the targets' project name (Build Settings -> Packaging) and the schemes name (Product -> Manage Schemes).



  • Add the previously downloaded automation lib to your newly created target.
    Add new file to project

    Add new file to project



    Choose the lib file and specify the target, i.e. where the lib will be added

    Choose the lib file and specify the target, i.e. where the lib will be added

  • After doing this, the automation lib will be listed in the 'Linked Binary With Libraries' list in the 'Build Phases' pane of the test target.
    Added automation library

    Added automation library

  • Add the CFNetwork framework to the list.
    Add CFNetwork.framework

    Add CFNetwork.framework



    Added automation lib and network framework

    Added automation lib and network framework

Note With iOS 8.3 you additionally have to add the IOKit.framework.

  • In the 'Build Settings' pane of the test, add the switches '-ObjC -all_load' to the option 'Other Linker Flags'.
    Set the switches '-ObjC' and '-all_load'

    Set the switches '-ObjC' and '-all_load'

After performing these steps, your project can be built using the newly created target and scheme for your iOS devices as well as simulators.

Note  If you see the debug output 'RxAutomationEngine init' in the console pane, your app has been instrumented successfully.


Successfully instrumented app

Successfully instrumented app


Note Because the Ranorex automation lib uses non-public APIs, make sure that you do not submit a Ranorex instrumented app to the app store as your app might be rejected and you might be banned from submitting apps to the app store for a period of time.

Note To add your device via Wi-Fi, it's necessary that the application under test is started on your iOS device or simulator.

Note The development provisioning profile should be used for testing your app and not the distribution provisioning profile.

Note To improve the object recognition of your app under test set the accessibility label attribute of your controls.