Ahad Khan
Ahad Khan

Reputation: 411

How to programmatically make phone call from apple watch app?

My Watch app has list of contact and I want open initiate call from watch. like we do in iPhone device.

I have tried this solution but not working for.

Upvotes: 1

Views: 1692

Answers (2)

Daniel Reiling
Daniel Reiling

Reputation: 87

Swift 4 / WatchOS 5

var phone = "1234567890"
if let telURL = URL(string: "tel:\(phone)") {
    let wkExt = WKExtension.shared()
    wkExt.openSystemURL(telURL)
}

Upvotes: 1

Ahad Khan
Ahad Khan

Reputation: 411

I have fixed it using following method

var phone = "123456"
if let telURL=NSURL(string:"tel:\(phone)") {
    let wkExt=WKExtension.sharedExtension()
    wkExtension.openSystemURL(telURL)
}

Upvotes: 3

Related Questions