React-native-firebase: ios app crashes after firebase login

Created on 12 May 2017  路  14Comments  路  Source: invertase/react-native-firebase

Hi,

my app works great on android (sim and real device), but the ios version crashes after login from firebase.

I have persistence enabled, but I tested it without, doesn't work.

Do you have any clue, where the problem could be?

Here is the stacktrace from ios simulator (Iphone 6):

May 12 21:05:31 Fionas-MBP EventManagment[47210]: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]'
*
* First throw call stack:
(
0 CoreFoundation 0x0000000110593b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f77c141 objc_exception_throw + 48
2 CoreFoundation 0x00000001104aeac2 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 354
3 CoreFoundation 0x00000001104ae92b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
4 EventManagment 0x000000010cfa6758 -[RNFirebaseAuth convertProviderData:] + 659
5 EventManagment 0x000000010cfa6b1b -[RNFirebaseAuth firebaseUserToDict:] + 723
6 EventManagment 0x000000010cfa2df8 __38-[RNFirebaseAuth addAuthStateListener]_block_invoke + 156
7 EventManagment 0x000000010cdadc11 __41-[FIRAuth addAuthStateDidChangeListener:]_block_invoke.362 + 58
8 libdispatch.dylib 0x00000001128b6585 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00000001128d7792 _dispatch_client_callout + 8
10 libdispatch.dylib 0x00000001128bf247 _dispatch_main_queue_callback_4CF + 1041
11 CoreFoundation 0x0000000110558909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
12 CoreFoundation 0x000000011051eae4 __CFRunLoopRun + 2164
13 CoreFoundation 0x000000011051e016 CFRunLoopRunSpecific + 406
14 GraphicsServices 0x0000000112faea24 GSEventRunModal + 62
15 UIKit 0x00000001133430d4 UIApplicationMain + 159
16 EventManagment 0x000000010cce19f7 main + 80
17 libdyld.dylib 0x000000011292065d start + 1
)

iOS Waiting for User Response

Most helpful comment

@maxdobler @Leeds-eBooks ok this is definitely fixed now, turns out ios was caching a previous build so tests were giving me a false positive - sorry about that.

v1.0.10 has the fix

All 14 comments

Try going back to a stable 1.0.1 version manually. 1.0.7 seems to be causing this issue.

Taking a look now, sorry about that, must be a weird edge case.

Could you let me know perhaps how you're authenticating? For example anon auth, email auth, social etc

@maxdobler @edwintoh-work pushed up a fix, sorry about that, give v1.0.8 a go please.

@Salakar I'm getting this crash on 1.0.9:

2017-05-13 12:34:28.719 meals[39130:1433588] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010e9b8b0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010dba1141 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010e8ed4a3 -[__NSArrayM insertObject:atIndex:] + 1603
    3   meals                               0x000000010b2bdced -[RNFirebaseAuth convertProviderData:] + 1389
    4   meals                               0x000000010b2be20a -[RNFirebaseAuth firebaseUserToDict:] + 1034
    5   meals                               0x000000010b2b756b __38-[RNFirebaseAuth addAuthStateListener]_block_invoke + 235
    6   meals                               0x000000010afd6f21 __41-[FIRAuth addAuthStateDidChangeListener:]_block_invoke.362 + 58
    7   libdispatch.dylib                   0x000000011277d4a6 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x00000001127a605c _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x000000011278740b _dispatch_main_queue_callback_4CF + 411
    10  CoreFoundation                      0x000000010e97d909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    11  CoreFoundation                      0x000000010e943ae4 __CFRunLoopRun + 2164
    12  CoreFoundation                      0x000000010e943016 CFRunLoopRunSpecific + 406
    13  GraphicsServices                    0x0000000113295a24 GSEventRunModal + 62
    14  UIKit                               0x0000000110dc60d4 UIApplicationMain + 159
    15  meals                               0x000000010aeacddf main + 111
    16  libdyld.dylib                       0x00000001127f265d start + 1
    17  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Rolling back to 1.0.2 fixes it so the bug must have been introduced between 1.0.3 and 1.0.9 inclusive.

Am taking another look, give me a moment, not sure why it's failing though, it works on the tests

Hi,
I tried the 1.0.9 Version and it crashes again. (See Stacktrace below) I use the pw authentication and after that there is a database query.
1.0.1 worked for me...

ay 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cRNFirebase |', 'color: hsl(222.4922359499622,99%,40%); font-weight: bold', '[debug]', 'creating Query ', '.info/serverTimeOffset', undefined
May 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cfirebase:db:ref |', 'color: hsl(84.98447189992442,99%,40%); font-weight: bold', '[debug]', 'Created new Reference', 1, '.info/serverTimeOffset'
May 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cfirebase:db:ref |', 'color: hsl(84.98447189992442,99%,40%); font-weight: bold', '[debug]', 'adding reference.on', 1, 'value'
May 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cfirebase:database |', 'color: hsl(307.4767078498866,99%,40%); font-weight: bold', '[debug]', 'on() : ', 1, 1, 'value'
May 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cfirebase:database |', 'color: hsl(307.4767078498866,99%,40%); font-weight: bold', '[debug]', 'Created new Database instance', { errorOnMissingPlayServices: true,
promptOnMissingPlayServices: true,
debug: true }
May 13 13:59:14 Fionas-MBP EventManagment[51728]: [] nw_connection_get_connected_socket_block_invoke 6 Connection has no connected handler
May 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cRNFirebase |', 'color: hsl(222.4922359499622,99%,40%); font-weight: bold', '[debug]', 'creating Query ', 'test', undefined
May 13 13:59:14 Fionas-MBP EventManagment[51728]: '%cfirebase:db:ref |', 'color: hsl(84.98447189992442,99%,40%); font-weight: bold', '[debug]', 'Created new Reference', 2, 'test'
May 13 13:59:14 Fionas-MBP EventManagment[51728]: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*
* First throw call stack:
(
0 CoreFoundation 0x000000010938eb0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000108577141 objc_exception_throw + 48
2 CoreFoundation 0x00000001092c34a3 -[__NSArrayM insertObject:atIndex:] + 1603
3 EventManagment 0x0000000105ce648d -[RNFirebaseAuth convertProviderData:] + 1389
4 EventManagment 0x0000000105ce69aa -[RNFirebaseAuth firebaseUserToDict:] + 1034
5 EventManagment 0x0000000105cdfd0b __38-[RNFirebaseAuth addAuthStateListener]_block_invoke + 235
6 EventManagment 0x0000000105a203e1 __41-[FIRAuth addAuthStateDidChangeListener:]_block_invoke.362 + 58
7 libdispatch.dylib 0x000000010cf38585 _dispatch_call_block_and_release + 12
8 libdispatch.dylib 0x000000010cf59792 _dispatch_client_callout + 8
9 libdispatch.dylib 0x000000010cf41247 _dispatch_main_queue_callback_4CF + 1041
10 CoreFoundation 0x0000000109353909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
11 CoreFoundation 0x0000000109319ae4 __CFRunLoopRun + 2164
12 CoreFoundation 0x0000000109319016 CFRunLoopRunSpecific + 406
13 GraphicsServices 0x000000010da45a24 GSEventRunModal + 62
14 UIKit 0x000000010b5800d4 UIApplicationMain + 159
15 EventManagment 0x00000001058f16ff main + 111
16 libdyld.dylib 0x000000010cfa265d start + 1
)

@maxdobler @Leeds-eBooks ok this is definitely fixed now, turns out ios was caching a previous build so tests were giving me a false positive - sorry about that.

v1.0.10 has the fix

No problem, will test now!

1.0.10 works now! Thank you @Salakar.

Offtopic question: Do I have to link react-native-firebase every time I update the version?

@maxdobler awesome. And no you don't - only need to do it once when you include RNFB for the first time in your project.

Yep works for me too

Very similar error is outputted if the null is passed instead of email into "signInWithEmailLink" function.

@jans-y could you make an issue for that so we can track it and add some validation in the SDK, it'll still error but at least you'll know why.

Was this page helpful?
0 / 5 - 0 ratings