“使用未解析的标识符”
问题描述:
我开始学习Swift 3,但我不断收到错误。“使用未解析的标识符”
例:
使用未解决的识别符 'UIAlertController'
使用未解决的识别符 'UIAlert'
等
我的代码
@IBAction func click(_ sender: Any) {
let alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
答
申请OS X
/macOS
使用自己的SDK
的,这是不一样的iOS
。
例如,UIKit
上iOS
是AppKit
上macOS
等价,但它们是不可互换 - 这意味着使用库,框架,SDK的,等了正确的平台。
+0
非常感谢您提供给我的信息。 –
“导入UIKit”? (等等......你的问题上有OSX标签,你是在为Mac或iOS编写代码吗?) –
没有这样的模块'UIKit' http://prntscr.com/fedb0q –
如果你正在创建一个Mac项目, “UI”-stuff不存在。 –