1

I'm using Google Analytics iOS SDK v3.17.0 installed via Cocoapods. When app opens, I debug memory graph. There is seen 32 memory leak in graph. If I don't initialize the Google Analytics, I don't see any leak in the same situation.

I searched below posts but nothing contains a specific problem and fix

https://github.com/firebase/quickstart-ios/issues/239

Memory Leak when Google Analytics sends a hit

How I initialize:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    //Window Properties
    window = UIWindow(frame: UIScreen.main.bounds)
    window?.makeKeyAndVisible()

    try! initGoogleAnalyticsManager()
    let splashController = SplashViewController()

    self.window?.rootViewController = splashController

    return true
}

 func initGoogleAnalyticsManager() throws{
    guard let gai = GAI.sharedInstance() else {
        assertionFailure("Google Analytics not configured correctly")
        throw ServiceError.createCustomError(title: "Google Analytics Error", message: "Google Analytics Ayarlanamadı", type: ServiceError.ErrorType.ServiceError)
    }
    guard let trackingId = some value else {
        assertionFailure("Google Analytics not configured correctly")
        throw ServiceError.createCustomError(title: "Google Analytics Error", message: "Google Analytics Trackin ID Problem", type: ServiceError.ErrorType.ServiceError)
    }
    gai.tracker(withTrackingId: trackingId)
    // Optional: automatically report uncaught exceptions.
    gai.trackUncaughtExceptions = true

    // Optional: set Logger to VERBOSE for debug information.
    // Remove before app release.
    #if DEBUG
    gai.logger.logLevel = .verbose
    #else
    gai.logger.logLevel = .none
    #endif
}

enter image description here

Emre Önder
  • 2,408
  • 2
  • 23
  • 73

0 Answers0