Use of unresolved identifier 'WKExtension'

天大地大妈咪最大 提交于 2019-12-12 05:36:33

问题


i want to make a phone call from Apple Watch too. I imported WatchKit. Then i put this code in my method:

if let telURL=NSURL(string:"tel:5553478") {
       let wkExtension=WKExtension.sharedExtension()
       wkExtension.openSystemURL(telURL)
}

It shows me an error: Use of unresolved identifier 'WKExtension' in line 2. I don't know what I am doing wrong :/


回答1:


WKExtension is only available on WatchOS 2.0, as you can see from Apple's prerelease reference. So I'm guessing you're either not using Xcode 7 or you're working on a v1.0 watch extension.

Create a new target and choose watch OS > Application.



来源:https://stackoverflow.com/questions/30863219/use-of-unresolved-identifier-wkextension

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