问题
As I watched the WWDC 2015 session video "Introducing WatchKit for watchOS 2" (at 13:29), I saw that it is possible to make phone calls directly on Apple Watch with the openSystem API. How can I use this API in Swift?
回答1:
You can use the openSystemURL method, which is available on the shared WKExtension
object. Pass a tel:
URL to this method to initiate a phone call.
if let telURL=NSURL(string:"tel:5553478") {
let wkExtension=WKExtension.sharedExtension()
wkExtension.openSystemURL(telURL)
}
回答2:
There seems to be a bug in beta 1 that is not allowing the use of openSystemURL on phone numbers. I've seen several sample projects as well as banged my own head against the wall attempting to get going. No implementation I've seen works. SMS works fine however.
来源:https://stackoverflow.com/questions/30827520/phone-call-from-apple-watch-with-opensystem-api