3

I am trying to make a phone call using

 UIApplication.shared.open(url as URL, options: [:], completionHandler: { success in

However, for iOS 10.3+ i get success closure when call is placed successfully or user hits cancel on prompt

For iOS 11 however the success closure is when you successfully open the URL.

Whats the best way to handle the difference and how do I get success when user hits on call on iOS11..

Somu
  • 601
  • 11
  • 22
  • What you want? Do you want to check the `completion` `closure` ? – Mannopson Oct 12 '17 at 00:42
  • 1
    I need to get the completion closure when user actually hits call or cancel button. Not when the prompt is displayed.. – Somu Oct 12 '17 at 00:47
  • iOS 10 used to give it properly but iOS 11 gives a success when prompt is displayed not when you actually place a call – Somu Oct 12 '17 at 00:47
  • This is a `completion` block and it's called when the operation is completed – Mannopson Oct 12 '17 at 00:51
  • Its different for iOS 11 and iOS 10 . Another question here for your reference https://stackoverflow.com/questions/45980857/prompt-when-trying-to-dial-a-phone-number-using-tel-scheme-on-ios-11 – Somu Oct 12 '17 at 00:52
  • I don't see any difference between the iOS 10 SDK and an iOS 11 SDK. First of all you'll need to check `canOpenURL`. It's returns a `Bool` value – Mannopson Oct 12 '17 at 00:57
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/156510/discussion-between-somu-and-mannopson). – Somu Oct 12 '17 at 00:58
  • 1
    I am already doing that. I guess you are not understanding my question my code hits completionHandler for openURL when I actually hit on call and make the call in case of iOS 10 in iOS 11 it hits the breakpoint when it shows the prompt itself. Its a bug reported to appple. I am finding a way to overcome that and know how to get a completion when user actually places call on iOS 11 – Somu Oct 12 '17 at 01:06
  • Can you show us a whole code? – Mannopson Oct 12 '17 at 04:02

0 Answers0