How to open the ios Native dialer app from my App

牧云@^-^@ 提交于 2019-12-10 17:18:37

问题


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.


回答1:


No, there is no workaround with those symbols.




回答2:


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



来源:https://stackoverflow.com/questions/27224480/how-to-open-the-ios-native-dialer-app-from-my-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!