rohfosho / CordovaCallNumberPlugin

Call a number directly from your cordova application.
MIT License
186 stars 151 forks source link

App crashes when calling from iPhone #36

Open jufracaqui opened 7 years ago

jufracaqui commented 7 years ago

The plugin works like a charm on Android, but when trying to make the phone call on iOS it breakes.

The code i use to make the call is this: window.plugins.CallNumber.callNumber(function(){}, function(){}, number, true);

The app crashes in CFCallNumber.m in this line: number = [number stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

This is the log i get from xCode:

AccesiveMobileTipo1[1398:1158471] -[__NSCFNumber stringByAddingPercentEscapesUsingEncoding:]: unrecognized selector sent to instance 0x16d00770
2017-03-29 10:15:47.068092 AccesiveMobileTipo1[1398:1158471] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber stringByAddingPercentEscapesUsingEncoding:]: unrecognized selector sent to instance 0x16d00770'
*** First throw call stack:
(0x1b8c0df7 0x1ab23077 0x1b8c6505 0x1b8c4579 0x1b7e93d8 0xab215 0x306d57 0x31353b 0x314d9f 0x314ba7 0x1b11b937 0x1b11b490)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
bandojulio commented 7 years ago

I had the same problem. It was solved by passing the phone number as string in JavaScript.

jufracaqui commented 7 years ago

Hello, i tried doing this num.toString() but i didn't get it to work. If you could please tell me how you did it i would really appreciate it.

bandojulio commented 7 years ago

Hello, I am using it like this: this.callNumber.callNumber("32134421", true)

ramondelemos commented 7 years ago

Hello, I have been facing this problem too. I am using numbers as strings but with the same problem. The application crashes after the call.

its-dev-fer commented 5 years ago

I was facing the same issue, in my case, I was using Ionic 4 and I was passing the number from my html component to my ts file as a number, to solve it I had to cast it from number to string, the application didn't crash after the call (iOS 12.3).