Accéder à la console

Get started with Performance Monitoring for iOS

Before you begin

If you haven't already, add Firebase to your iOS project.

Step 1: Add Performance Monitoring to your app

  1. Open the podfile you created for the project (or run pod init to create one), then add the following line inside the target section:

    pod 'Firebase/Performance'
  2. In the directory of your podfile, run the following command to install the Performance Monitoring SDK:

    pod install
  3. Open the .xcworkspace file using Xcode.

  4. Import the Firebase module in your UIApplicationDelegate:

    Swift

    import Firebase

    Objective-C

    @import Firebase;
  5. Configure a FirebaseApp shared instance, typically in your app's application:didFinishLaunchingWithOptions: method:

    Swift

    // Use Firebase library to configure APIs
    FirebaseApp.configure()

    Objective-C

    // Use Firebase library to configure APIs
    [FIRApp configure];
  6. Recompile your app.

Firebase is now monitoring automatic duration traces and automatic HTTP/S network requests.

Step 2: Check the Firebase console for performance data

Note that Performance Monitoring data usually displays within 12 hours of testing your app.

  1. Run your app in the Xcode simulator (Product > Run).

  2. 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.

Known issues

  • 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.

Next steps