不幸的是,用户创建的警告编译指示#warning
在Xcode 7.1中不再适用于我。
这些#
前缀命令是否仅在Objective-C Foundation Headers中?是否有另一种方法来指定它们,或者是否可以将它们与桥接头一起使用?
答案 0 :(得分:0)
看起来你正试图在Swift中使用#warning
。这不起作用,#warning
仅与Objective-C兼容。我唯一想到的是评论或this thread中列出的内容,例如来自inerrupt的答案:
所以我要做的是在Swift文件中声明FIXME()函数:
@availability(iOS, deprecated=1.0, message="I'm not deprecated, please ***FIXME**")
func FIXME()
{
}
当我从任何其他功能调用它时,它确实显示警告,例如
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
FIXME() // Incomplete method implementation.
return 0
}
对于Swift 2使用
@available(iOS, deprecated=1.0, message="I'm not deprecated, please ***FIXME**")