I'm trying to sort out this error message:
Exception '-[_NSDisctionary0 length]: unrecognized selector sent to instance 0x78964120' was thrown while invoking alerWithArgs on target AlertManager with params
It's coming from my line of code:
const response.error = 'bad credentials'
Alert.alert('Login error', response.error, [{ text: 'Ok' }])
Even when I copy/paste from Facebook documentation I get the error:
Alert.alert(
'Alert Title',
'My Alert Msg',
[
{text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
{text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{text: 'OK', onPress: () => console.log('OK Pressed')},
]
)
The component is imported and all, obvious from the error message. I guess.
Has anyone come across this? Don't know what to make of it?
Using expo, I kept running into this issue because I would forget to add both of the string arguments needed:
Alert.alert(
'Alert Title',
'My Alert Msg',
[ ...
Alert.alert explicitly needs the first for the title of the alert and the second for the message. I can still replicate the issue: if you omit one of the strings once and you get this error, the message will still keep coming up - even if you have subsequently passed the correct string arguments - unless both the app AND the emulator/expo are restarted.
Doing so fixed the issue 100% of the times
well very late for this user, but adding this in here just in case someone else finds it useful.
managed to cause this issue by creating an alert in expo without the message, it just had title and buttons.
It caused the error mentioned above and not only that it then broke expo essentially and caused every other alert to fail aswell from then on looking like the issue the poster had aswell. I had to close the expo app fully not just reload and of course add in an empty '' for the message.
Restart your expo will fix this problem
To anyone seeing this, this is a bug of the expo that once you get the Alert. alert the wrong without adding the description parameter in the expo, it will show the error. The error will last ever long unless you restart the packager and expo!
Solution: Restart the package!
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