How to call phone numbers from iphone simulator

4,303 views
Skip to first unread message

ghani

unread,
Sep 18, 2009, 7:40:40 AM9/18/09
to iPhone SDK Development
Hi in my application i have to call phone number when button press,
can any one please help how to do this exactly with code, this is very
urgent for me, please help.Thank you.

Radif Sharafullin

unread,
Sep 18, 2009, 7:44:37 AM9/18/09
to iphonesdkd...@googlegroups.com
 [NSURL URLWithString:@"tel://+1-800-999-9999"]

Radif

Radif Sharafullin

unread,
Sep 18, 2009, 7:47:39 AM9/18/09
to iphonesdkd...@googlegroups.com

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://1800-999-9999"]];


Radif
On Sep 18, 2009, at 7:40 AM, ghani wrote:

ghani

unread,
Sep 18, 2009, 7:48:57 AM9/18/09
to iPhone SDK Development
Hi Radif Sharafullin thank you for replying, i tried this but how can
i come to whether it is calling or not from simulator i don't have
iphone device to test and when i execute this program it is not doing
any thing, please help me how to test it.

On Sep 18, 4:44 pm, Radif Sharafullin <radif.sharaful...@gmail.com>
wrote:

iDeveloper

unread,
Sep 18, 2009, 8:02:01 AM9/18/09
to iphonesdkd...@googlegroups.com
You can't test this from the simulator. openURL for SMS, phone call,
email won't work on the simulator, only on the device.

ghani

unread,
Sep 18, 2009, 8:05:05 AM9/18/09
to iPhone SDK Development
Hi can any one please reply how to test iphone calls are working or
not in iphone simulator, its ugent.Thank you.

ghani

unread,
Sep 18, 2009, 8:10:06 AM9/18/09
to iPhone SDK Development
Thanks for replying can u please tell me the procedure how to test
whether i am calling phone number from iphone simulator.I want exact
procedure plz help me.

Radif Sharafullin

unread,
Sep 18, 2009, 8:13:30 AM9/18/09
to iphonesdkd...@googlegroups.com
These 2 lines should dial from the device and, as far as I know, ignored in simulator. If dialed the app delegate receive handle URL call (don't need to implement) then applicationWillTerminate.
After that app exits successfully and control hands to the Phone app (which is missing in simulator)
------------------------------------------------
NSString * phoneNumber=@"18009999999";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",phoneNumber]]];
------------------------------------------------
Radif,

Radif Sharafullin

unread,
Sep 18, 2009, 8:16:41 AM9/18/09
to iphonesdkd...@googlegroups.com
#ifdef TARGET_IPHONE_SIMULATOR
   
//you are on the simulator and cannot dial
NSLog(@"Cannot Dial");
#else
   
//you are on the device and can dial
NSString * phoneNumber=@"18009999999";
[[UIApplication sharedApplicationopenURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",phoneNumber]]];
Reply all
Reply to author
Forward
0 new messages