Reputation: 21
Sorry for bad English
In FirstViewController.h I wrote:
- (IBAction)goToURL:(id)sender;
in FirstViewController.m I wrote:
- (IBAction)goToURL:(id)sender;
{
NSURL *myURL = [NSURL URLWithString:@"tel://01999999999"];
[[UIApplication sharedApplication] openURL:myURL];
}
I added a button as you can see in the picture. http://url.bg/show-image.php?id=683e9491d40e684f2eaefdbe19fe1b45
The problem is that the simulator is not giving me an error, I know wrong somewhere?
Upvotes: 0
Views: 282
Reputation: 10182
That code will not do anything in the simulator because the simulator doesn't have a Phone app. You'll need to test that on an actual iPhone.
EDIT: There's also a syntax error in your .m file. I'm assuming that you just made that error typing the question because I don't think it would compile. Anyway, you shouldn't have a semicolon before the first curly bracket. Like so;
- (IBAction)goToURL:(id)sender
{
NSURL *myURL = [NSURL URLWithString:@"tel://01999999999"];
[[UIApplication sharedApplication] openURL:myURL];
}
Upvotes: 6