Before you begin
If you haven't already, add Firebase to your iOS project.
Step 1: Add Performance Monitoring to your app
Open the podfile you created for the project (or run
pod initto create one), then add the following line inside the target section:
In the directory of your podfile, run the following command to install the Performance Monitoring SDK:
.xcworkspacefile using Xcode.
- Import the Firebase module in your
- Configure a
FirebaseAppshared instance, typically in your app's
// Use Firebase library to configure APIs FirebaseApp.configure()
// Use Firebase library to configure APIs [FIRApp configure];
Recompile your app.
Step 2: Check the Firebase console for performance data
Note that Performance Monitoring data usually displays within 12 hours of testing your app.
Run your app in the Xcode simulator (Product > Run).
Confirm that Performance Monitoring data displays in the Firebase console.
Step 3: (Optional) Add custom monitoring for specific code
You can create custom traces to monitor performance data associated with specific code in your app.
With a custom trace, you can measure how long it takes your app to complete a specific task or set of tasks, such as loading a set of images or querying your database. The default metric for a custom trace is its duration, but you can also add custom metrics, such as cache hits and memory warnings.
In your code, you define the beginning and the end of a custom trace (and add any desired custom metrics) using the API provided by the Performance Monitoring SDK.
Visit Add custom monitoring for specific app code to learn more about these features and how to add them to your app.
Step 4: Deploy your app then review results
After you've validated Performance Monitoring using the Xcode simulator and one or more test devices, you can deploy the updated version of your app to your users.
You can monitor performance data in the Firebase console.
- Performance Monitoring has known compatibility issues with GTMSQLite. We recommend not using Performance Monitoring with apps that use GTMSQLite.
- Method swizzling after calling
FirebaseApp.configure()might interfere with the Performance Monitoring SDK.
- Known issues with the iOS 8.0-8.2 Simulator prevent Performance Monitoring from capturing performance events. These issues are fixed in the iOS 8.3 Simulator and later versions.
- Connections established using NSURLSession's backgroundSessionConfiguration will exhibit longer than expected connection times. These connections are executed out-of-process and the timings reflect in-process callback events.