Phone call from Apple Watch with openSystem API?

∥☆過路亽.° 提交于 2019-12-11 09:07:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!