MrHertal / react-native-twilio-phone

Twilio Voice React Native module.
MIT License
153 stars 66 forks source link

Emergency help. SIGABRT: __NSCFNumber > Could not cast value of type '__NSCFNumber' (0x1f1c58d28) to 'NSString' (0x1f1c58cf8). > NSString #72

Closed duypxd closed 2 years ago

duypxd commented 2 years ago

We got this error 3 days ago. Our app is working normally in prod so far and no new updates. @MrHertal :(

`SIGABRT: NSCFNumber > Could not cast value of type 'NSCFNumber' (0x1f1c58d28) to 'NSString' (0x1f1c58cf8).

NSString`

jorgeavaldez commented 2 years ago

Same here

therealemjy commented 2 years ago

Same thing happening with our app.

jorgeavaldez commented 2 years ago

Broke in our app in production, just checked. After digging through the internals, one thing that stands out is that the PKPushPayload includes a number value under a timeout key. By the time it crashes, it's trying to dispatch the received payload from Twilio in our case back to TwilioPhone.

dchannell commented 2 years ago

Same here. App immediately crashes on incoming calls. It seems to be something related to the handling of the Voip Push Notification and serializing the push payload data.

The culprit seems to be related with:

[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:[NSString stringWithFormat:@"%@", type]];

Note: I noticed that the only value in the payload that is of type __NSCFNumber is the twi_timeout property.

duypxd commented 2 years ago

This is not a good firecracker solution. But it works fine for me. cc: @MrHertal

image

MrHertal commented 2 years ago

Thanks to all of you for reporting this nasty bug.

I am currently working on a fix.

MrHertal commented 2 years ago

This should work now with v1.8.1 (see https://github.com/MrHertal/react-native-twilio-phone/pull/74)

The bug was due to the fact that in its incoming push, Twilio sends a twi_answer_timeout field as an integer but the module code was expecting a string ... while on the Android side,twi_answer_timeout is indeed a string 😭

duypxd commented 2 years ago

Thanks so much for the support. @MrHertal 🏆

therealemjy commented 2 years ago

Thanks for the quick update! Much appreciated.

manjotssd commented 2 years ago

thank you for quick fix @MrHertal