Before instrumenting OneAgent, create a mobile app in your monitoring environment through which you will be able to monitor your actual mobile app:
- From the navigation menu, select Deploy Dynatrace.
- Select Set up mobile monitoring and type the name of your mobile app.
- Select Create mobile app.
Subsequently, you can instrument your app via the CocoaPods, Swift Package Manager, or Carthage-based approach. For advanced auto-instrumentation, use the configuration keys.
When you use Dynatrace.framework or the static libDynatrace.a library to instrument your iOS app, you need to perform some additional steps:
Additional steps for framework
Perform these additional steps if you use Dynatrace.framework:
Remove iOS Simulator architecture of the release binary
- In Xcode, add a Run Script Phase as the last Build Phase of your Application Target.
- Select Run script only when installing.
This removes the iOS Simulator architecture from your release binary used for AppStore Connect upload.
Xcode 12 build fails with architecture mismatch errors
If the build fails with architecture mismatch errors, turn on workspace validation.
- In Xcode, go to Build Settings.
- For Validate Workspace, select Yes.
Additional steps for library
Perform these additional steps if you use the libDynatrace.a library:
Add linker flag
- In Xcode, go to the Build Settings section of your Application Target.
- Expand Linking.
- Add the
-ObjCflag to Other Linker Flags.
Make Dynatrace available to Swift code
You can skip this step if your application does not have Swift code or it doesn't need access to the Dynatrace library.
- We asssume you already created Objective-C bridging header file for your Swift code in Xcode.
- Make sure you set the bridging header file in your Application Target build settings.
- Add the following import line to the bridging header file: