iOS Agent manual setup

AppMon UEM's Mobile Application support lets you trace visitors, actions, and action PurePaths triggered by your iOS application. To trace activity that was not auto-instrumented, you can add Mobile Agent method calls to your code.

Existing users

If you used the Mobile Agent prior to AppMon 6.3, see Migrating from previous iOS Mobile Agent versions for library files and classes descriptions.

Manual iOS agent setup

Go to the Dynatrace Application Monitoring downloads page. Under the ADK (Agent Development Kit) section, download the UEM Mobile ADK zip file, which contains dynatrace-mobile-agents-<version>.zip. Extract this file to any folder.

In Xcode, add the following from the \iOS\Agent\ folder of the extracted .zip to your Xcode Project and all targets that use the agent. Select Copy items if needed.

  • If your deployment target is iOS 8+, drag the Dynatrace.framework folder to Embedded Binaries.
  • If your deployment target is iOS 7 and earlier, drag the libDynatrace.a file to Linked Frameworks and Libraries.
  • For all deployment targets, add Dynatrace.h.
Note

Do not add both Dynatrace.framework and libDynatrace.a to the same project. Use only one of them depending on your deployment target.

Add the required frameworks and libraries to your Xcode Project. To do this:

  • In the project navigator, select your project and target.
  • Select the Build Phases tab.
  • Expand Link Binaries with Libraries.
  • Click the + button, and select the following frameworks and libraries:
    libsqlite3.dylib CoreLocation.framework CoreTelephony.framework Security.framework SystemConfiguration.framework libz.dylib libc++.dylib MessageUI.framework

Add flags to Other Linker Flags.

  • In the project navigator, select your project.
  • Select your target, then select Build Settings.
  • Add the -ObjC option to the Other Linker Flags setting.

Set the build setting Strip Style to Debugging Symbols.
This increases the size of your binary slightly, but leaves intact the information needed for on-device crash symbolication. This is not necessary if you intend to use Mobile Symbolication Service to symbolicate your crash reports.

Add the key DTXAgentStartupPath to your Info.plist file. Its value is your instrumented web server. For example http(s)://<myWebServer>:<my port>.

Add the key DTXApplicationID to your Info.plist file. This value is used to identifier for your App on the AppMon Server. For example easyTravel mobile.

Instrument a manual setup

Use the suitable keys from Auto-Instrumentation for iOS to enable and control auto instrumentation.

Perform this step only if using Dynatrace.framework with a deployment target iOS 8 or later.

Add a Run Script Phase as last Build Phase of your application target and select Run script only when installing. This removes the iOS simulator architecture from your release binary used for iTunes Connect upload. Add the following script:

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
	  FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
	  FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
	  EXTRACTED_ARCHS=()
	  for ARCH in $ARCHS
	  do
		    lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
		    EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
	  done
	  lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
  	rm "${EXTRACTED_ARCHS[@]}"
  	rm "$FRAMEWORK_EXECUTABLE_PATH"
  	mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done