I've been debugging my application which uses Firebase for memory leaks, and after some time digging into my code I've found that the actual problem is the FIRApp.configure()
it inside my application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
in AppDelegate.
As far as I know everything is configured in the right way, I'm using cocoa pods for installing and updating firebase. I'm also modifying my statusBar inside my AppDelegate the code is as follows:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FIRApp.configure()
setStatusBarBackgroundColor(UIColor(red: 231/250, green: 97/250, blue: 44/250, alpha: 1.0))
// Override point for customization after application launch.
return true
}
var window: UIWindow?
override init() {
}
func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
return
}
statusBar.backgroundColor = color
}
I'm also showing the instruments tool to show more details on the leak:
And I'm sure it's the FIRApp.configure()
because I removed it for testing and there were no leaks.
Hope anyone has an idea on how to fix this leak, thank you.
I have the same problem. After some digging, it seems like Firebase Analytics is the one causing the leak.
Here is what I did:
FIREBASE_ANALYTICS_COLLECTION_ENABLED
to NO
FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED
to YES
in GoogleServiceIn-info.plist
. At least this works for me. For those who rely on firebase analytics this definitely is a bug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With