react-native-sms
react-native-sms copied to clipboard
SendSMS.send got 4 arguments, expected 3
Hello,
When running in releaseMode
on real Android devices (tested on HTC one, samsung galaxy s7, samsung galaxy s5) the app crashes at the moment we run SendSMS.send
.
When connecting the device to the phone and running adb logcat gives a NativeArgumentsParseException: SendSMS.send got 4 arguments, expected 3
the full error looks like this :
.... AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
.... AndroidRuntime: Process: com.sp00t, PID: 1903
.... AndroidRuntime: com.facebook.react.bridge.NativeArgumentsParseException: SendSMS.send got 4 arguments, expected 3
.... AndroidRuntime: at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
.... AndroidRuntime: at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:136)
.... AndroidRuntime: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
.... AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:751)
.... AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
.... AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
.... AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
.... AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
.... AndroidRuntime: at java.lang.Thread.run(Thread.java:762)
The code sending the sms looks like this :
Alert.alert(
`${title}`,
message,
[
{
text: I18n.t('send'),
style: 'cancel',
onPress: () => {
SendSMS.send({
body: I18n.t('smsText'),
recipients: smsList.map(contact => contact.phone),
successTypes: ['sent', 'queued']
}, (completed, cancelled, error) => {
console.log(`SMS Callback: Completed: ${completed} Cancelled: ${cancelled} Error: ${error}`)
})
}
},
{
text: I18n.t('cancel'),
onPress: () => {
}
}
]
)
Changing the API
version does not seem to help (tested with 3 different android SDK version in the build.gradle
.
Interestingly It works on the emulator
is this still happening to you?