简体   繁体   中英

How to open the ios Native dialer app from my App

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.

不,这些符号没有解决方法。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM