I have a simple IPhone application that has two buttons
Buttons1's title is set to a telephone number
Button2 's title is set to an Email address
On clicking Button1
the below given code executes [inside button's click event]
Similarly for Button2's case: the below given code executes
I want to know a few things
As soon as I click on either the Button1 or Button2 the application closes and nothing happens. I am running this application on IPhone and not in simulator.
Is there anything wrong with the code?
I am also not able to understand why my application closes
Can anybody explain?
Thanks
Buttons1's title is set to a telephone number
Button2 's title is set to an Email address
On clicking Button1
the below given code executes [inside button's click event]
Code:
UIButton *btn=(UIButton*)sender;
NSString *strPhoneNumber=[@"tel://" stringByAppendingString: btn.currentTitle ];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:strPhoneNumber]];
Similarly for Button2's case: the below given code executes
Code:
UIButton *btn=(UIButton*)sender;
NSString *strPhoneNumber=[@"mailto://" stringByAppendingString: btn.currentTitle ];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:strPhoneNumber]];
I want to know a few things
As soon as I click on either the Button1 or Button2 the application closes and nothing happens. I am running this application on IPhone and not in simulator.
Is there anything wrong with the code?
I am also not able to understand why my application closes
Can anybody explain?
Thanks