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.
我一直在调试我的应用程序,它使用Firebase进行内存泄漏,在深入研究我的代码一段时间后,我发现实际的问题是我的应用程序(应用程序:UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)中的FIRApp.configure()。
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:
据我所知,一切都以正确的方式配置,我正在使用cocoa pods安装和更新firebase。我也在修改我的AppDelegate中的statusBar代码如下:
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.
我确定它是FIRApp.configure(),因为我删除它进行测试,没有泄漏。
Hope anyone has an idea on how to fix this leak, thank you.
希望大家对如何修复泄漏有想法,谢谢。
1 个解决方案
#1
1
I have the same problem. After some digging, it seems like Firebase Analytics is the one causing the leak.
我也有同样的问题。经过一些挖掘,似乎是Firebase Analytics造成了泄漏。
Here is what I did:
我所做的是:
- set
FIREBASE_ANALYTICS_COLLECTION_ENABLED
toNO
- FIREBASE_ANALYTICS_COLLECTION_ENABLED设置为不
-
FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED
toYES
inGoogleServiceIn-info.plist
. - 在GoogleServiceIn-info.plist中,FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED为YES。
At least this works for me. For those who rely on firebase analytics this definitely is a bug.
至少这对我来说是可行的。对于那些依赖于firebase分析的人来说,这绝对是一个错误。
#1
1
I have the same problem. After some digging, it seems like Firebase Analytics is the one causing the leak.
我也有同样的问题。经过一些挖掘,似乎是Firebase Analytics造成了泄漏。
Here is what I did:
我所做的是:
- set
FIREBASE_ANALYTICS_COLLECTION_ENABLED
toNO
- FIREBASE_ANALYTICS_COLLECTION_ENABLED设置为不
-
FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED
toYES
inGoogleServiceIn-info.plist
. - 在GoogleServiceIn-info.plist中,FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED为YES。
At least this works for me. For those who rely on firebase analytics this definitely is a bug.
至少这对我来说是可行的。对于那些依赖于firebase分析的人来说,这绝对是一个错误。