Firebase is back at Google I/O on May 10! Register now

Firebase Performance Monitoring'i devre dışı bırakın

Koleksiyonlar ile düzeninizi koruyun İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.

Kullanıcılarınızın Firebase Performance Monitoring'i kullanmayı seçmesine veya devre dışı bırakmasına izin vermek için, uygulamanızı Performance Monitoring'i etkinleştirebilecek ve devre dışı bırakabilecek şekilde yapılandırmak isteyebilirsiniz. Ayrıca, uygulama geliştirme ve test etme sırasında bu özelliği yararlı bulabilirsiniz.

Aşağıdakiler dikkate alınması gereken bazı seçeneklerdir:

  • Uygulamanızı oluştururken Performans İzleme SDK'sını çalışma zamanında yeniden etkinleştirme seçeneğiyle devre dışı bırakabilirsiniz.

  • Uygulamanızı Performans İzleme SDK'sı etkinken oluşturabilirsiniz, ancak Firebase Remote Config'i kullanarak çalışma zamanında devre dışı bırakma seçeneğiniz vardır.

  • Performans İzleme SDK'sını çalışma zamanında etkinleştirme seçeneği olmadan tamamen devre dışı bırakabilirsiniz.

Uygulama oluşturma işleminiz sırasında Performans İzlemeyi devre dışı bırakın

Uygulama oluşturma işleminiz sırasında Performans İzlemeyi devre dışı bırakmanın yararlı olabileceği durumlardan biri, uygulama geliştirme ve test etme sırasında uygulamanızın yayın öncesi bir sürümünden performans verilerini raporlamaktan kaçınmaktır.

Performans İzlemeyi devre dışı bırakmak veya devre dışı bırakmak için Apple uygulamanızın özellik listesi dosyasına ( Info.plist ) iki anahtardan birini ekleyebilirsiniz:

  • Performans İzlemeyi devre dışı bırakmak, ancak uygulamanızın çalışma zamanında etkinleştirmesine izin vermek için uygulamanızın Info.plist dosyasında firebase_performance_collection_enabled değerini false olarak ayarlayın.

  • Performance Monitoring'i çalışma zamanında etkinleştirme seçeneği olmadan tamamen devre dışı bırakmak için uygulamanızın Info.plist dosyasında firebase_performance_collection_deactivated true olarak ayarlayın.

Remote Config kullanarak çalışma zamanında uygulamanızı devre dışı bırakın

Firebase Remote Config, uygulamanızın davranışında ve görünümünde değişiklikler yapmanızı sağlar, böylece uygulamanızın dağıtılan örneklerinde Performans İzlemeyi devre dışı bırakmanız için ideal bir yol sağlar.

Apple uygulamanızın bir sonraki başlatılışında Performans İzleme veri toplamayı devre dışı bırakmak için aşağıda gösterilen örnek kodu kullanın. Remote Config'i bir Apple uygulamasında kullanma hakkında daha fazla bilgi için Apple platformlarında Firebase Remote Config'i kullanma bölümüne bakın.

  1. Podfile dosyanızda Remote Config kullanıldığından emin olun:

    pod 'Firebase/RemoteConfig'
    
  2. Uygulamanızın AppDelegate dosyasının en üstüne şunu ekleyin:

    Süratli

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    import FirebaseRemoteConfig
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    @import FirebaseRemoteConfig;
    
  3. AppDelegate dosyanızda, application:didFinishLaunchingWithOptions: örnek yöntemindeki launchOptions ifadelerine aşağıdaki kodu ekleyin:

    Süratli

    Not: Bu ürün macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    remoteConfig = RemoteConfig.remoteConfig()
    // You can change the "false" below to "true" to permit more fetches when validating
    // your app, but you should change it back to "false" or remove this statement before
    // distributing your app in production.
    let remoteConfigSettings = RemoteConfigSettings(developerModeEnabled: false)
    remoteConfig.configSettings = remoteConfigSettings!
    // Load in-app defaults from a plist file that sets perf_disable to false until
    // you update values in the Firebase console.
    remoteConfig.setDefaultsFromPlistFileName("RemoteConfigDefaults")
    // Important! This needs to be applied before FirebaseApp.configure()
    if !remoteConfig["perf_disable"].boolValue {
        // The following line disables all automatic (out-of-the-box) monitoring
        Performance.sharedInstance().isInstrumentationEnabled = false
        // The following line disables all custom monitoring
        Performance.sharedInstance().isDataCollectionEnabled = false
    }
    else {
        Performance.sharedInstance().isInstrumentationEnabled = true
        Performance.sharedInstance().isDataCollectionEnabled = true
    }
    // Use Firebase library to configure APIs
    FirebaseApp.configure()
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    self.remoteConfig = [FIRRemoteConfig remoteConfig];
    // You can change the NO below to YES to permit more fetches when validating
    // your app, but you should change it back to NO or remove this statement before
    // distributing your app in production.
    FIRRemoteConfigSettings *remoteConfigSettings =
        [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:NO];
    self.remoteConfig.configSettings = remoteConfigSettings;
    // Load in-app defaults from a plist file that sets perf_disable to false until
    // you update values in the Firebase console.
    [self.remoteConfig setDefaultsFromPlistFileName:@"RemoteConfigDefaults"];
    // Important! This needs to be applied before [FIRApp configure]
    if (!self.remoteConfig[@"perf_disable"].numberValue.boolValue) {
        // The following line disables all automatic (out-of-the-box) monitoring
        [FIRPerformance sharedInstance].instrumentationEnabled = NO;
        // The following line disables all custom monitoring
        [FIRPerformance sharedInstance].dataCollectionEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].instrumentationEnabled = YES;
        [FIRPerformance sharedInstance].dataCollectionEnabled = YES;
    }
    // Use Firebase library to configure APIs
    [FIRApp configure];
    
  4. ViewController.m dosyasında veya uygulamanız tarafından kullanılan başka bir uygulama dosyasında, Remote Config değerlerini almak ve etkinleştirmek için aşağıdaki kodu ekleyin:

    Süratli

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    //RemoteConfig fetch and activation in your app, shortly after startup
    remoteConfig.fetch(withExpirationDuration: TimeInterval(30.0)) { (status, error) -> Void in
      if status == .success {
        print("Config fetched!")
        self.remoteConfig.activateFetched()
      } else {
        print("Config not fetched")
        print("Error \(error!.localizedDescription)")
      }
    }
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    //RemoteConfig fetch and activation in your app, shortly after startup
    [self.remoteConfig fetchWithExpirationDuration:30.0 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
      if (status == FIRRemoteConfigFetchStatusSuccess) {
        NSLog(@"Config fetched!");
        [self.remoteConfig activateFetched];
      } else {
        NSLog(@"Config not fetched");
        NSLog(@"Error %@", error.localizedDescription);
      }
    }];
    
  5. Firebase konsolunda Performans İzlemeyi devre dışı bırakmak için uygulamanızın projesinde bir perf_disable parametresi oluşturun ve ardından değerini true olarak ayarlayın.

    perf_disable değerini false olarak ayarlarsanız, Performans İzleme etkin kalır.

Otomatik veya özel veri toplamayı ayrı ayrı devre dışı bırakın

Özel izlemeden ayrı olarak tüm otomatik (kutudan çıktığı gibi) izlemeyi devre dışı bırakmanıza izin vermek için yukarıda ve Firebase konsolunda gösterilen kodda bazı değişiklikler yapabilirsiniz.

  1. application:didFinishLaunchingWithOptions: örnek yöntemindeki launchOptions ifadelerine aşağıdaki kodu ekleyin (yukarıda aynı örnek yöntemi için gösterilenin yerine):

    Süratli

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    remoteConfig = FIRRemoteConfig.remoteConfig()
    let remoteConfigSettings = FIRRemoteConfigSettings(developerModeEnabled: true)
    remoteConfig.configSettings = remoteConfigSettings!
    // Important! This needs to be applied before FirebaseApp.configure()
    if remoteConfig["perf_disable_auto"].boolValue {
        // The following line disables all automatic (out-of-the-box) monitoring
        Performance.sharedInstance().isInstrumentationEnabled = false
    }
    else {
        Performance.sharedInstance().isInstrumentationEnabled = true
    }
    if remoteConfig["perf_disable_manual"].boolValue {
        // The following line disables all custom monitoring
        Performance.sharedInstance().isDataCollectionEnabled = false
    }
    else {
        Performance.sharedInstance().isDataCollectionEnabled = true
    }
    // Use Firebase library to configure APIs
    FirebaseApp.configure()
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    self.remoteConfig = [FIRRemoteConfig remoteConfig];
    FIRRemoteConfigSettings *remoteConfigSettings =
        [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:YES];
    self.remoteConfig.configSettings = remoteConfigSettings;
    // Important! This needs to be applied before [FirebaseApp configure]
    if (self.remoteConfig[@"perf_disable_auto"].numberValue.boolValue) {
        // The following line disables all automatic (out-of-the-box) monitoring
        [FIRPerformance sharedInstance].instrumentationEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].instrumentationEnabled = YES;
    }
    if (self.remoteConfig[@"perf_disable_manual"].numberValue.boolValue) {
        // The following line disables all custom monitoring
        [FIRPerformance sharedInstance].dataCollectionEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].dataCollectionEnabled = YES;
    }
    // Use Firebase library to configure APIs
    [FirebaseApp configure];
    
  2. Firebase konsolunda aşağıdakileri tamamlayın:

    • Tüm otomatik (kullanıma hazır) izlemeyi devre dışı bırakmak için, uygulamanızın projesinde bir perf_disable_auto parametresi oluşturun ve ardından değerini true olarak ayarlayın.
    • Tüm özel izlemeyi devre dışı bırakmak için uygulamanızın projesinde bir perf_disable_manual parametresi oluşturun, ardından değerini true olarak ayarlayın.
,

Kullanıcılarınızın Firebase Performance Monitoring'i kullanmayı seçmesine veya devre dışı bırakmasına izin vermek için, uygulamanızı Performance Monitoring'i etkinleştirebilecek ve devre dışı bırakabilecek şekilde yapılandırmak isteyebilirsiniz. Ayrıca, uygulama geliştirme ve test etme sırasında bu özelliği yararlı bulabilirsiniz.

Aşağıdakiler dikkate alınması gereken bazı seçeneklerdir:

  • Uygulamanızı oluştururken Performans İzleme SDK'sını çalışma zamanında yeniden etkinleştirme seçeneğiyle devre dışı bırakabilirsiniz.

  • Uygulamanızı Performans İzleme SDK'sı etkinken oluşturabilirsiniz, ancak Firebase Remote Config'i kullanarak çalışma zamanında devre dışı bırakma seçeneğiniz vardır.

  • Performans İzleme SDK'sını çalışma zamanında etkinleştirme seçeneği olmadan tamamen devre dışı bırakabilirsiniz.

Uygulama oluşturma işleminiz sırasında Performans İzlemeyi devre dışı bırakın

Uygulama oluşturma işleminiz sırasında Performans İzlemeyi devre dışı bırakmanın yararlı olabileceği durumlardan biri, uygulama geliştirme ve test etme sırasında uygulamanızın yayın öncesi bir sürümünden performans verilerini raporlamaktan kaçınmaktır.

Performans İzlemeyi devre dışı bırakmak veya devre dışı bırakmak için Apple uygulamanızın özellik listesi dosyasına ( Info.plist ) iki anahtardan birini ekleyebilirsiniz:

  • Performans İzlemeyi devre dışı bırakmak, ancak uygulamanızın çalışma zamanında etkinleştirmesine izin vermek için uygulamanızın Info.plist dosyasında firebase_performance_collection_enabled değerini false olarak ayarlayın.

  • Performance Monitoring'i çalışma zamanında etkinleştirme seçeneği olmadan tamamen devre dışı bırakmak için uygulamanızın Info.plist dosyasında firebase_performance_collection_deactivated true olarak ayarlayın.

Remote Config kullanarak çalışma zamanında uygulamanızı devre dışı bırakın

Firebase Remote Config, uygulamanızın davranışında ve görünümünde değişiklikler yapmanızı sağlar, böylece uygulamanızın dağıtılan örneklerinde Performans İzlemeyi devre dışı bırakmanız için ideal bir yol sağlar.

Apple uygulamanızın bir sonraki başlatılışında Performans İzleme veri toplamayı devre dışı bırakmak için aşağıda gösterilen örnek kodu kullanın. Remote Config'i bir Apple uygulamasında kullanma hakkında daha fazla bilgi için Apple platformlarında Firebase Remote Config'i kullanma bölümüne bakın.

  1. Podfile dosyanızda Remote Config kullanıldığından emin olun:

    pod 'Firebase/RemoteConfig'
    
  2. Uygulamanızın AppDelegate dosyasının en üstüne şunu ekleyin:

    Süratli

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    import FirebaseRemoteConfig
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    @import FirebaseRemoteConfig;
    
  3. AppDelegate dosyanızda, application:didFinishLaunchingWithOptions: örnek yöntemindeki launchOptions ifadelerine aşağıdaki kodu ekleyin:

    Süratli

    Not: Bu ürün macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    remoteConfig = RemoteConfig.remoteConfig()
    // You can change the "false" below to "true" to permit more fetches when validating
    // your app, but you should change it back to "false" or remove this statement before
    // distributing your app in production.
    let remoteConfigSettings = RemoteConfigSettings(developerModeEnabled: false)
    remoteConfig.configSettings = remoteConfigSettings!
    // Load in-app defaults from a plist file that sets perf_disable to false until
    // you update values in the Firebase console.
    remoteConfig.setDefaultsFromPlistFileName("RemoteConfigDefaults")
    // Important! This needs to be applied before FirebaseApp.configure()
    if !remoteConfig["perf_disable"].boolValue {
        // The following line disables all automatic (out-of-the-box) monitoring
        Performance.sharedInstance().isInstrumentationEnabled = false
        // The following line disables all custom monitoring
        Performance.sharedInstance().isDataCollectionEnabled = false
    }
    else {
        Performance.sharedInstance().isInstrumentationEnabled = true
        Performance.sharedInstance().isDataCollectionEnabled = true
    }
    // Use Firebase library to configure APIs
    FirebaseApp.configure()
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    self.remoteConfig = [FIRRemoteConfig remoteConfig];
    // You can change the NO below to YES to permit more fetches when validating
    // your app, but you should change it back to NO or remove this statement before
    // distributing your app in production.
    FIRRemoteConfigSettings *remoteConfigSettings =
        [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:NO];
    self.remoteConfig.configSettings = remoteConfigSettings;
    // Load in-app defaults from a plist file that sets perf_disable to false until
    // you update values in the Firebase console.
    [self.remoteConfig setDefaultsFromPlistFileName:@"RemoteConfigDefaults"];
    // Important! This needs to be applied before [FIRApp configure]
    if (!self.remoteConfig[@"perf_disable"].numberValue.boolValue) {
        // The following line disables all automatic (out-of-the-box) monitoring
        [FIRPerformance sharedInstance].instrumentationEnabled = NO;
        // The following line disables all custom monitoring
        [FIRPerformance sharedInstance].dataCollectionEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].instrumentationEnabled = YES;
        [FIRPerformance sharedInstance].dataCollectionEnabled = YES;
    }
    // Use Firebase library to configure APIs
    [FIRApp configure];
    
  4. ViewController.m dosyasında veya uygulamanız tarafından kullanılan başka bir uygulama dosyasında, Remote Config değerlerini almak ve etkinleştirmek için aşağıdaki kodu ekleyin:

    Süratli

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    //RemoteConfig fetch and activation in your app, shortly after startup
    remoteConfig.fetch(withExpirationDuration: TimeInterval(30.0)) { (status, error) -> Void in
      if status == .success {
        print("Config fetched!")
        self.remoteConfig.activateFetched()
      } else {
        print("Config not fetched")
        print("Error \(error!.localizedDescription)")
      }
    }
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    //RemoteConfig fetch and activation in your app, shortly after startup
    [self.remoteConfig fetchWithExpirationDuration:30.0 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
      if (status == FIRRemoteConfigFetchStatusSuccess) {
        NSLog(@"Config fetched!");
        [self.remoteConfig activateFetched];
      } else {
        NSLog(@"Config not fetched");
        NSLog(@"Error %@", error.localizedDescription);
      }
    }];
    
  5. Firebase konsolunda Performans İzlemeyi devre dışı bırakmak için uygulamanızın projesinde bir perf_disable parametresi oluşturun ve ardından değerini true olarak ayarlayın.

    perf_disable değerini false olarak ayarlarsanız, Performans İzleme etkin kalır.

Otomatik veya özel veri toplamayı ayrı ayrı devre dışı bırakın

Özel izlemeden ayrı olarak tüm otomatik (kutudan çıktığı gibi) izlemeyi devre dışı bırakmanıza izin vermek için yukarıda ve Firebase konsolunda gösterilen kodda bazı değişiklikler yapabilirsiniz.

  1. application:didFinishLaunchingWithOptions: örnek yöntemindeki launchOptions ifadelerine aşağıdaki kodu ekleyin (yukarıda aynı örnek yöntemi için gösterilenin yerine):

    Süratli

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    remoteConfig = FIRRemoteConfig.remoteConfig()
    let remoteConfigSettings = FIRRemoteConfigSettings(developerModeEnabled: true)
    remoteConfig.configSettings = remoteConfigSettings!
    // Important! This needs to be applied before FirebaseApp.configure()
    if remoteConfig["perf_disable_auto"].boolValue {
        // The following line disables all automatic (out-of-the-box) monitoring
        Performance.sharedInstance().isInstrumentationEnabled = false
    }
    else {
        Performance.sharedInstance().isInstrumentationEnabled = true
    }
    if remoteConfig["perf_disable_manual"].boolValue {
        // The following line disables all custom monitoring
        Performance.sharedInstance().isDataCollectionEnabled = false
    }
    else {
        Performance.sharedInstance().isDataCollectionEnabled = true
    }
    // Use Firebase library to configure APIs
    FirebaseApp.configure()
    

    Amaç-C

    Not: Bu Firebase ürünü, macOS, Mac Catalyst, watchOS hedeflerinde mevcut değildir.
    self.remoteConfig = [FIRRemoteConfig remoteConfig];
    FIRRemoteConfigSettings *remoteConfigSettings =
        [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:YES];
    self.remoteConfig.configSettings = remoteConfigSettings;
    // Important! This needs to be applied before [FirebaseApp configure]
    if (self.remoteConfig[@"perf_disable_auto"].numberValue.boolValue) {
        // The following line disables all automatic (out-of-the-box) monitoring
        [FIRPerformance sharedInstance].instrumentationEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].instrumentationEnabled = YES;
    }
    if (self.remoteConfig[@"perf_disable_manual"].numberValue.boolValue) {
        // The following line disables all custom monitoring
        [FIRPerformance sharedInstance].dataCollectionEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].dataCollectionEnabled = YES;
    }
    // Use Firebase library to configure APIs
    [FirebaseApp configure];
    
  2. Firebase konsolunda aşağıdakileri tamamlayın:

    • Tüm otomatik (kullanıma hazır) izlemeyi devre dışı bırakmak için, uygulamanızın projesinde bir perf_disable_auto parametresi oluşturun ve ardından değerini true olarak ayarlayın.
    • Tüm özel izlemeyi devre dışı bırakmak için uygulamanızın projesinde bir perf_disable_manual parametresi oluşturun, ardından değerini true olarak ayarlayın.
,

Kullanıcılarınızın Firebase Performance Monitoring'i kullanmayı seçmesine veya devre dışı bırakmasına izin vermek için, uygulamanızı Performance Monitoring'i etkinleştirebilecek ve devre dışı bırakabilecek şekilde yapılandırmak isteyebilirsiniz. Ayrıca, uygulama geliştirme ve test etme sırasında bu özelliği yararlı bulabilirsiniz.

Aşağıdakiler dikkate alınması gereken bazı seçeneklerdir:

  • Uygulamanızı oluştururken Performans İzleme SDK'sını çalışma zamanında yeniden etkinleştirme seçeneğiyle devre dışı bırakabilirsiniz.

  • Uygulamanızı Performans İzleme SDK'sı etkinken oluşturabilirsiniz, ancak Firebase Remote Config'i kullanarak çalışma zamanında devre dışı bırakma seçeneğiniz vardır.

  • Performans İzleme SDK'sını çalışma zamanında etkinleştirme seçeneği olmadan tamamen devre dışı bırakabilirsiniz.

Uygulama oluşturma işleminiz sırasında Performans İzlemeyi devre dışı bırakın

Uygulama oluşturma işleminiz sırasında Performans İzlemeyi devre dışı bırakmanın yararlı olabileceği durumlardan biri, uygulama geliştirme ve test etme sırasında uygulamanızın yayın öncesi bir sürümünden performans verilerini raporlamaktan kaçınmaktır.

To disable or deactivate Performance Monitoring, you can add one of two keys to the property list file ( Info.plist ) for your Apple app:

  • To disable Performance Monitoring, but allow your app to enable it at runtime, set firebase_performance_collection_enabled to false in your app's Info.plist file.

  • To completely deactivate Performance Monitoring, with no option to enable it at runtime, set firebase_performance_collection_deactivated to true in your app's Info.plist file.

Disable your app at runtime using Remote Config

Firebase Remote Config lets you make changes to the behavior and appearance of your app, so it provides an ideal way to let you disable Performance Monitoring in deployed instances of your app.

To disable Performance Monitoring data collection the next time that your Apple app starts, use the example code shown below. For more information about using Remote Config in an Apple app, see Use Firebase Remote Config on Apple platforms .

  1. Ensure that Remote Config is used in your Podfile :

    pod 'Firebase/RemoteConfig'
    
  2. Add the following to the top of your app's AppDelegate file:

    Süratli

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    import FirebaseRemoteConfig
    

    Amaç-C

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    @import FirebaseRemoteConfig;
    
  3. In your AppDelegate file, add the following code to the launchOptions statements in the application:didFinishLaunchingWithOptions: instance method:

    Süratli

    Note: This product is not available on macOS, Mac Catalyst, watchOS targets.
    remoteConfig = RemoteConfig.remoteConfig()
    // You can change the "false" below to "true" to permit more fetches when validating
    // your app, but you should change it back to "false" or remove this statement before
    // distributing your app in production.
    let remoteConfigSettings = RemoteConfigSettings(developerModeEnabled: false)
    remoteConfig.configSettings = remoteConfigSettings!
    // Load in-app defaults from a plist file that sets perf_disable to false until
    // you update values in the Firebase console.
    remoteConfig.setDefaultsFromPlistFileName("RemoteConfigDefaults")
    // Important! This needs to be applied before FirebaseApp.configure()
    if !remoteConfig["perf_disable"].boolValue {
        // The following line disables all automatic (out-of-the-box) monitoring
        Performance.sharedInstance().isInstrumentationEnabled = false
        // The following line disables all custom monitoring
        Performance.sharedInstance().isDataCollectionEnabled = false
    }
    else {
        Performance.sharedInstance().isInstrumentationEnabled = true
        Performance.sharedInstance().isDataCollectionEnabled = true
    }
    // Use Firebase library to configure APIs
    FirebaseApp.configure()
    

    Amaç-C

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    self.remoteConfig = [FIRRemoteConfig remoteConfig];
    // You can change the NO below to YES to permit more fetches when validating
    // your app, but you should change it back to NO or remove this statement before
    // distributing your app in production.
    FIRRemoteConfigSettings *remoteConfigSettings =
        [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:NO];
    self.remoteConfig.configSettings = remoteConfigSettings;
    // Load in-app defaults from a plist file that sets perf_disable to false until
    // you update values in the Firebase console.
    [self.remoteConfig setDefaultsFromPlistFileName:@"RemoteConfigDefaults"];
    // Important! This needs to be applied before [FIRApp configure]
    if (!self.remoteConfig[@"perf_disable"].numberValue.boolValue) {
        // The following line disables all automatic (out-of-the-box) monitoring
        [FIRPerformance sharedInstance].instrumentationEnabled = NO;
        // The following line disables all custom monitoring
        [FIRPerformance sharedInstance].dataCollectionEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].instrumentationEnabled = YES;
        [FIRPerformance sharedInstance].dataCollectionEnabled = YES;
    }
    // Use Firebase library to configure APIs
    [FIRApp configure];
    
  4. In ViewController.m , or another implementation file used by your app, add the following code to fetch and activate Remote Config values:

    Süratli

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    //RemoteConfig fetch and activation in your app, shortly after startup
    remoteConfig.fetch(withExpirationDuration: TimeInterval(30.0)) { (status, error) -> Void in
      if status == .success {
        print("Config fetched!")
        self.remoteConfig.activateFetched()
      } else {
        print("Config not fetched")
        print("Error \(error!.localizedDescription)")
      }
    }
    

    Amaç-C

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    //RemoteConfig fetch and activation in your app, shortly after startup
    [self.remoteConfig fetchWithExpirationDuration:30.0 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
      if (status == FIRRemoteConfigFetchStatusSuccess) {
        NSLog(@"Config fetched!");
        [self.remoteConfig activateFetched];
      } else {
        NSLog(@"Config not fetched");
        NSLog(@"Error %@", error.localizedDescription);
      }
    }];
    
  5. To disable Performance Monitoring in the Firebase console, create a perf_disable parameter in your app's project, then set its value to true .

    If you set the value of perf_disable to false , Performance Monitoring remains enabled.

Disable automatic or custom data collection separately

You can make some changes to the code shown above and in the Firebase console to let you disable all automatic (out-of-the-box) monitoring separately from custom monitoring.

  1. Add the following code to the launchOptions statements in the application:didFinishLaunchingWithOptions: instance method (instead of what's shown above for the same instance method):

    Süratli

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    remoteConfig = FIRRemoteConfig.remoteConfig()
    let remoteConfigSettings = FIRRemoteConfigSettings(developerModeEnabled: true)
    remoteConfig.configSettings = remoteConfigSettings!
    // Important! This needs to be applied before FirebaseApp.configure()
    if remoteConfig["perf_disable_auto"].boolValue {
        // The following line disables all automatic (out-of-the-box) monitoring
        Performance.sharedInstance().isInstrumentationEnabled = false
    }
    else {
        Performance.sharedInstance().isInstrumentationEnabled = true
    }
    if remoteConfig["perf_disable_manual"].boolValue {
        // The following line disables all custom monitoring
        Performance.sharedInstance().isDataCollectionEnabled = false
    }
    else {
        Performance.sharedInstance().isDataCollectionEnabled = true
    }
    // Use Firebase library to configure APIs
    FirebaseApp.configure()
    

    Amaç-C

    Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
    self.remoteConfig = [FIRRemoteConfig remoteConfig];
    FIRRemoteConfigSettings *remoteConfigSettings =
        [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:YES];
    self.remoteConfig.configSettings = remoteConfigSettings;
    // Important! This needs to be applied before [FirebaseApp configure]
    if (self.remoteConfig[@"perf_disable_auto"].numberValue.boolValue) {
        // The following line disables all automatic (out-of-the-box) monitoring
        [FIRPerformance sharedInstance].instrumentationEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].instrumentationEnabled = YES;
    }
    if (self.remoteConfig[@"perf_disable_manual"].numberValue.boolValue) {
        // The following line disables all custom monitoring
        [FIRPerformance sharedInstance].dataCollectionEnabled = NO;
    }
    else {
        [FIRPerformance sharedInstance].dataCollectionEnabled = YES;
    }
    // Use Firebase library to configure APIs
    [FirebaseApp configure];
    
  2. Complete the following in the Firebase console:

    • To disable all automatic (out-of-the-box) monitoring, create a perf_disable_auto parameter in your app's project, then set its value to true .
    • To disable all custom monitoring, create a perf_disable_manual parameter in your app's project, then set its value to true .