Watch a quick video overview of the main steps of the process.
Direct link: https://appdynamo.wistia.com/medias/pohgsjj2dd
1. Access the instrumentation window
- In the left navigation bar, select the application that you have enabled.
This is either the server-side instrumented application that your mobile application communicates with or an application that you have created manually.
- On the left nav bar, click Configure -> Instrumentation.
- Click the End User Experience tab.
- Click the Mobile Apps subtab.
2. Download the iOS SDK
Click the iOS SDK link in step. This downloads a file named iOSAgent.zip.
You must download the SDK separately for each application that you instrument.
3. Record Your Application Key
Record the application key generated for this application, displayed in step.
You will need this key when you modify the source code.
4. Install the Framework
Uncompress the .zip file you downloaded: you have a file named
ADEUMInstrumentation.framework. Drag this framework file into your project's Frameworks directory.
5. Modify the Application Source Code - Objective C
Edit your app's main.m file to initialize the mobile agent as soon as the app launches. This registers your application, and only needs to be done once in your code.
In your application's main.m, add this import:
Add the call to
ADEumInstrumentation initWithKeypassing your application key, recorded in step 3, as a parameter by adding this line of code to the beginning of your application's main() function:
Your main.m should look something like this:
- Save the file.
5A. Modify the Application Source Code - SWIFT
The iOS Agent is compatible with applications created using the Swift programming language.
- Create a bridging header, as described in this Apple documentation, to expose the Agent's Objective C code to your Swift code.
To your bridging header, add this code:
didFinishLaunchingWithOptions, initialize the SDK like this:
Save the file.
6. Add Required Libraries, as Necessary
The Appdynamics iOS agent requires the following libraries:
To add the libraries
- Select the target that builds your app in Xcode.
- Select the Build Phases tab.
- Expand the Link Binary With Libraries section.
- If any of the above libraries are not listed:
- Click the + button.
- Locate the missing library in the list.
- Click Add.
Repeat this step for each missing library.
7. Rebuild You Application
Rebuild your application with the modified application code.
To enable the agent to provide human-readable information in the crash snapshots that are produced if the application crashes, compile with the
DWARF with dSYM file option to create a debug symbols file for the application. For more details about why you would want to do this see Get Human-Readable Crash Snapshots.
To rebuild your application
- In Xcode, select your project in the Project Navigator.
- In the target list, select the target that builds your application.
- Select the Build Settings tab.
- In the Build Options section, make sure that the Debugging Information Format is set to "DWARF with dSYM File".
Rebuild the Xcode project.
8. Upload the dSYM File
This step is optional but highly recommended if you plan to monitor crashes. AppDynamics needs the dSYM file for the application to produce human-readable stack traces for crash snapshots.
For details about why you should do this, see Get Human-Readable Crash Snapshots.
If you update the application, you need to provide the new dSYM file for the new application version. The dSYM file contains an UUID that links it to a specific Xcode build, so AppDynamics can unambiguously match the correct dSYM file with an incoming crash report with no additional information.
- Get the dSYM file from Xcode
- Upload the dSYM file to AppDynamics using the UI
Upload the dSYM File to AppDynamics Using the API
Get the dSYM file from Xcode
- In Xcode, run the Xcode build: Product > Build.
- View the log navigator: View > Navigators > Show Log Navigator.
- Click the log entry for the most recent build.
- Near the end of the log, find and mouse over the log entry named "Generate <Your_App_Name>.app.dSYM".
- Click the button on the right side of the entry you found in step #4 to expand it.
The end of the displayed command is the path to the dSYM file.
- Navigate to this dSYM file in the Finder.
- Right click on the dSYM file and choose Compress.
- Upload to AppDynamics the .zip file that Finder generates.
Upload the dSYM file to AppDynamics using the UI
- In the instrumentation window in the controller UI, click the Upload dSym package file for iOS crashes button.
- In the Xcode dSym package upload window click Select zipped dSym file.
The uploader expects a file with a .zip extension.
- In the file browser locate the zipped dSYM file for the application that you are instrumenting and click Open.
- Click Upload.
Upload the dSYM File to AppDynamics Using the REST API
The API uses HTTP basic authentication to send a PUT request to AppDynamics. The username is your AppDynamics account name and the password is your EUM license key.
1. Set up your HTTP basic authentication credentials
- In the upper right section of the Controller UI, click Settings -> License.
- Scroll down to the End User Experience Management panel.
- Note the Account Name at the top of the panel. This is your username for authentication.
- Note the License Key just below the Account Name. This is your password for authentication.
- URL-encode the account name and the license key.
- Generate an authentication string of the form: "<URL-encoded EUEM account name>:<URL-encoded EUEM license key>" and base64 encode it. You will use this string the following step.
- Add an authentication header to each request, setting its value to "Basic <authentication string>"
2. Send the dSYM file
Send the dSym as a zip archive in the body of a PUT request to the following URI:
The content type of the body must be application/zip if the file is a zip file or application/gzip if it is a gzip file. Only these formats are accepted.
Sample Request and Response Using the REST API
This is a sample request and response using the REST API.
The following example uses
curl to send a dSym file named UISampleApp.app.dSYM.zip. The account name is "Example account " and the license key/password is Example-License-Key-4e8ec2ae6cfe. The plus signs replace spaces in the account name when the account name is URL-encoded.
The successful output of the sample request looks like this:
9. Customize Your Instrumentation (Optional)
ADEUMInstrumentation class has additional methods to allow you to extend the kinds of data you can collect and aggregate using AppDynamics. There are three basic kinds of extensions that you can create:
- custom timers
- custom metrics
- information points
In addition, if you are using an environment with an on-premise version of the EUEM Processor, you need to update your code to indicate the URL to which your agent should send its beacons.
For more information, see Customize Your iOS Mobile Instrumentation.