0

I tried to embed direct calling function to restaurants in Xcode(swift).

I thought that this code would work, but it is not.

@IBAction func MakeCall(sender: AnyObject) {
    var url : NSURL = NSURL(string: "tel://555555555"))!
    UIApplication.sharedApplication().openURL(url)

but doesn't work. neither "sms:// "mailto//.

Is there any other function to make calling?

thank you.

veryNew
  • 125
  • 1
  • 13
  • 2
    Define “doesn't work”. At least the code you show here has a syntax error so it shouldn't even compile, but is that the issue? If not, what happens when this code runs? Are you sure that this code runs, i.e. have you connected the action correctly, etc? Are you running the code on an actual device capable of making calls (iPhone, not simulator)? – Arkku Jul 26 '15 at 18:06
  • this has nothing to do with Xcode… – The Paramagnetic Croissant Jul 26 '15 at 18:26
  • Are you running your code on iOS Simulator? – Ozgur Vatansever Jul 26 '15 at 18:30
  • I apologise for the insincere question. I shouldn't asked like this. I think I did it right, I runs well, if I put URL instead of "tel://55555555:. – veryNew Jul 26 '15 at 18:31
  • yes I run on IOS Simulator. that would be a problem. Thank you so much. I just begin to learn Xcode and swift, no helper around me. this website is only the source i could get helped, even though my English is not good enough. Thank you again – veryNew Jul 26 '15 at 18:34

0 Answers0