Configure your Xamarin iOS app to be testable
The application configured following the steps below, should be used for testing purposes only and will not be accepted in Apple App Store.
Since building Xamarin iOS mobile applications produce native iOS apps, they can be easily tested with Test Studio Mobile. This getting-started article provides more details about testing native iOS apps.
Add Extension
- Download the Test Studio Mobile extension for iOS and unpack it.
-
To bring the extension into your project, select the project from the solution explorer and press Command + Option + A to open the
Add files
dialog. Add libMobileTestingExtension.a to the project. When prompted, tell Xamarin Studio to copy it into the project.
Add URL Type
-
Open the Info.plist file, navigate to the Advanced tab and add a new
URL Type
.- Identifier: com.telerik.automation
- URL Schemes: APPLICATIONNAME
- Role: Editor
The URL Schemes should not contain any spaces. The APPLICATIONNAME portion need not match your app name exactly. The only requirement is that APPLICATIONNAME is unique so it does not conflict with another testable application.
If you deploy the app to an iOS 9 device then you must use one of the names listed below:- telerikmt1
- telerikmt2
- telerikmt3
- telerikmt4
- telerikmt5
- telerikmt6
- telerikmt7
- telerikmt8
- telerikmt9
- telerikmt10
- tsdemoapplication
Configure Xamarin.iOS to Link the Library
- Right-click the Xamarin iOS project and choose Options
- Expand Build and select iOS Build
-
At the bottom of the dialog set the following to the Additional mtouch arguments text field:
-gcc_flags "-L${ProjectDir} -force_load ${ProjectDir}/libMobileTestingExtension.a -lMobileTestingExtension -licucore -framework CFNetwork -framework Security -framework QuartzCore"
When targetting iOS7 you may need to add the -all_load flag to the Additional mtouch arguments:
-gcc_flags "-L${ProjectDir} -all_load -force_load ${ProjectDir}/libMobileTestingExtension.a -lMobileTestingExtension -licucore -framework CFNetwork -framework Security -framework QuartzCore"
More information about linking iOS libraries in Xamarin project is available here.
-
Close the Project Options dialog and click Run.
After the
Build Succeeded
message, you may have to wait up to 10 seconds for the application to deploy. The device's screen will be black in the meantime.You may need to close your application (and the Mobile Testing Agent app) on the device before deploying.