I want to open the native dialer app and allow the user to enter the phone number there. The reason why i want this is because in my app the user needs to use USSD codes in order to make calls, but using the code bellow nothing happens (nothing is started)
NSString *phoneNumber = [#"tel://" stringByAppendingString:number];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
I read here (StackOverflow) that making calls from your app that contain * and # are forbidden.
So i want to ask is there any work around this limitation.
No, there is no workaround with those symbols.
Well i was looking for the same some time ago, i found out that the emulators has problem doing this kind of thing, you should try on a real devices.
Edit from Apple documentation:
To prevent users from maliciously redirecting phone calls or changing
the behavior of a phone or account, the Phone app supports most, but
not all, of the special characters in the tel scheme. Specifically, if
a URL contains the * or # characters, the Phone app does not attempt
to dial the corresponding phone number. If your app receives URL
strings from the user or an unknown source, you should also make sure
that any special characters that might not be appropriate in a URL are
escaped properly.
Also written in this post
Related
After updating to 10.3, my app no longer automatically dials a phone number after pressing the call button in my app using the openURL: options: completionHandler: method.
Instead, a prompt comes up every time to confirm the user's intentions.
As per the Apple Documentation:
The tel URL scheme is used to launch the Phone app on iOS devices and initiate dialing of the specified phone number. When a user taps a telephone link in a webpage, iOS displays an alert asking if the user really wants to dial the phone number and initiates dialing if the user accepts. When a user opens a URL with the tel scheme in a native app, iOS does not display an alert and initiates dialing without further prompting the user. However, a native app can be configured to display its own alert.
According to this, the prompt displays for webpages but doesn't display in a native iOS app.
Could this be a bug in 10.3? Or is there a new function I need to use or a new property to include in the info.plist I do not know about?
Thanks.
This is listed as a known issue in the 10.3 release notes.
https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/
openURL
When a third party application invokes openURL: on a tel://,
facetime://, or facetime-audio:// URL, iOS displays a prompt and
requires user confirmation before dialing.
It is also listed in the Security content of the 10.3 update, so I'm assuming this a new feature that is here to stay.
An issue existed in iOS allowing for calls without prompting. This
issue was addressed by prompting a user to confirm call initiation.
This is not the first time, Apple developers have reactivated this alert for url schemes? I remember that they did this kind activation, even in few other earlier updates, and they rolled back in the next OS update.
In the case of 10.3.1, I read a news that in the US there were many 911 calls fraudulently dialed. https://9to5mac.com/2017/03/06/911-ios-exploit/
In my opinion, the alert restriction has been incorporated to put stop for wrong 911 dials.
I am confident that, Apple cannot enforce this kind of arbitrary changes to API's/Schemes quite often and then, which is largely affecting the user's experience.
I have a Speed Dial App in the store for the last 8 years. https://itunes.apple.com/us/app/speed-dial/id306569903?ls=1&mt=8#
In the last few weeks, so many users are complaining about this new restriction of one more touch on the speed dial.
For now, we have to wait until Apple fixes this known issue in the next update. Because, there are 100s productivity apps, which rely on the URL scheme and no alert scheme.
After updating to 10.3, my app no longer automatically dials a phone number after pressing the call button in my app using the openURL: options: completionHandler: method.
Instead, a prompt comes up every time to confirm the user's intentions.
As per the Apple Documentation:
The tel URL scheme is used to launch the Phone app on iOS devices and initiate dialing of the specified phone number. When a user taps a telephone link in a webpage, iOS displays an alert asking if the user really wants to dial the phone number and initiates dialing if the user accepts. When a user opens a URL with the tel scheme in a native app, iOS does not display an alert and initiates dialing without further prompting the user. However, a native app can be configured to display its own alert.
According to this, the prompt displays for webpages but doesn't display in a native iOS app.
Could this be a bug in 10.3? Or is there a new function I need to use or a new property to include in the info.plist I do not know about?
Thanks.
This is listed as a known issue in the 10.3 release notes.
https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/
openURL
When a third party application invokes openURL: on a tel://,
facetime://, or facetime-audio:// URL, iOS displays a prompt and
requires user confirmation before dialing.
It is also listed in the Security content of the 10.3 update, so I'm assuming this a new feature that is here to stay.
An issue existed in iOS allowing for calls without prompting. This
issue was addressed by prompting a user to confirm call initiation.
This is not the first time, Apple developers have reactivated this alert for url schemes? I remember that they did this kind activation, even in few other earlier updates, and they rolled back in the next OS update.
In the case of 10.3.1, I read a news that in the US there were many 911 calls fraudulently dialed. https://9to5mac.com/2017/03/06/911-ios-exploit/
In my opinion, the alert restriction has been incorporated to put stop for wrong 911 dials.
I am confident that, Apple cannot enforce this kind of arbitrary changes to API's/Schemes quite often and then, which is largely affecting the user's experience.
I have a Speed Dial App in the store for the last 8 years. https://itunes.apple.com/us/app/speed-dial/id306569903?ls=1&mt=8#
In the last few weeks, so many users are complaining about this new restriction of one more touch on the speed dial.
For now, we have to wait until Apple fixes this known issue in the next update. Because, there are 100s productivity apps, which rely on the URL scheme and no alert scheme.
What I'm trying to replicate:
The app 'Cobook Contacts' allows you to select multiple contacts. You can then send a message to these contacts. The app does this by opening the native messages app, and populating it with MULTIPLE NUMBERS.
What I've tried:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"sms:123,456"]];
This only opens messages with the first number populated.
What I Need:
A way to replicate what Cobook Contacts does. Using an MFMessageComposeController is not good enough, I'd like to open the native messaging app. Working example code is bounty worthy.
UPDATE:
I haven't gotten anywhere further, but the object files for the cobook app are actually available at https://cobook.co/open-source. I don't know if it's possible to reverse engineer this to the extent of finding out how they open the message app however.
I also worked on the code of the app (also credit to DJ_Lectr0 in the comments) and found that this works:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"sms:/open?addresses=555.234.5678,555.234.5454;body=Hello,%20World"]];
This allows you to specify multiple addresses (phone numbers) as well as add a body (which you can obviously leave off)!
Some interesting and related material. This is the only real documentation about opening the SMS from Apple that I could find. It neither specifies the body argument or multiple addressees, but does show you the different string formats/characters you can use. This SO answer also got me thinking about using an argument (in this case it ended up being addresses although I tried about a hundred different things) and was where I found the body option.
This is what I ended up with when I use the exact code above:
I know how to add a contact, I know how to initiate a phone call.
What I don't know, if it's possible to initiate a phone call only by contact name.
What I mean: I add a new contact with phone number with pin code, like 123456*9, this is possible as I already did it.
How call can be initiated when you don't add contact number in this?
BTW I found in Apple docs here
To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone application supports most, but not all, of the special characters in the tel scheme. Specifically, if a URL contains the * or # characters, the Phone application does not attempt to dial the corresponding phone number. If your application receives URL strings from the user or an unknown source, you should also make sure that any special characters that might not be appropriate in a URL are escaped properly. For native applications, use the stringByAddingPercentEscapesUsingEncoding: method of NSString to escape characters, which returns a properly escaped version of your original string.
and please check if this solution works for you.
So,
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:#"tel: 14165551212"]];
calls a phone number on the iPhone.
What other things can we do, though? I'm trying to make a simple app that has a list of phone numbers. It dials the first one in that list, and re-dials if it is engaged. Is this possible?
You can certainly open a link in Safari. It should also be possible to go to the Mail app and create an email. I heard that you can also go to the Messages app.
And, I don't think that what you described is possible. Your app can't do much from the background. And I'm pretty sure that it can't control/monitor any other apps(including Phone), so it will not be possible to re-dial it.
Hope it helps
What you are describing is partially possible starting with iOS 4.0 and even better with iOS 5. You may initiate dialling a number from your app with telprompt URL schema and when iOS finishes with the call it will open your app again, see Stackoverflow answer
What is problematic is getting the result of the call: whether it was successful or engaged, etc. You may want to have a look at CTCallCenter class reference.