@@ -49,13 +49,15 @@ - (id)init {
49
49
- (void )dealloc {
50
50
DLog (@" RNFirebaseAuth:instance-destroyed" );
51
51
52
- for (NSString * key in authStateHandlers) {
52
+ NSArray *authStateKeys = [authStateHandlers allKeys ];
53
+ for (NSString * key in authStateKeys) {
53
54
FIRApp *firApp = [RNFirebaseUtil getApp: key];
54
55
[[FIRAuth authWithApp: firApp] removeAuthStateDidChangeListener: [authStateHandlers valueForKey: key]];
55
56
[authStateHandlers removeObjectForKey: key];
56
57
}
57
58
58
- for (NSString * key in idTokenHandlers) {
59
+ NSArray *idTokenKeys = [idTokenHandlers allKeys ];
60
+ for (NSString * key in idTokenKeys) {
59
61
FIRApp *firApp = [RNFirebaseUtil getApp: key];
60
62
[[FIRAuth authWithApp: firApp] removeIDTokenDidChangeListener: [idTokenHandlers valueForKey: key]];
61
63
[idTokenHandlers removeObjectForKey: key];
@@ -65,13 +67,15 @@ - (void)dealloc {
65
67
- (void )invalidate {
66
68
// dealloc sometimes is not called when app is reloaded.
67
69
68
- for (NSString * key in authStateHandlers) {
70
+ NSArray *authStateKeys = [authStateHandlers allKeys ];
71
+ for (NSString * key in authStateKeys) {
69
72
FIRApp *firApp = [RNFirebaseUtil getApp: key];
70
73
[[FIRAuth authWithApp: firApp] removeAuthStateDidChangeListener: [authStateHandlers valueForKey: key]];
71
74
[authStateHandlers removeObjectForKey: key];
72
75
}
73
76
74
- for (NSString * key in idTokenHandlers) {
77
+ NSArray *idTokenKeys = [idTokenHandlers allKeys ];
78
+ for (NSString * key in idTokenKeys) {
75
79
FIRApp *firApp = [RNFirebaseUtil getApp: key];
76
80
[[FIRAuth authWithApp: firApp] removeIDTokenDidChangeListener: [idTokenHandlers valueForKey: key]];
77
81
[idTokenHandlers removeObjectForKey: key];
0 commit comments