Xcode 8警告“实例方法几乎符合可选要求" [英] Xcode 8 Warning "Instance method nearly matches optional requirement"
问题描述
我在Xcode 8中将我的(macOS)项目转换为Swift 3,并通过在swift类中实现的几种委托方法收到以下警告:
I converted my (macOS) project to Swift 3 in Xcode 8 and I get the following warnings with several delegate methods I implement in swift classes:
Instance method 'someMethod' nearly matches optional requirement of protocol 'protocolName'
我通过诸如applicationDidFinishLaunching
和applicationDidBecomeActive
的几种NSApplicationDelegate方法获得了此信息:
I get this for several NSApplicationDelegate methods like applicationDidFinishLaunching
and applicationDidBecomeActive
:
但对于tableViewSelectionDidChange
的实现也是如此:
But also for implementations of tableViewSelectionDidChange
:
我使用代码完成功能来插入方法签名,还尝试从SDK标头中复制它们以排除错别字.警告只是不会消失,永远不会调用这些方法.
I used code completion to insert the method signatures and also tried copying them from the SDK-headers to rule out typos. The warnings just don't disappear and the methods are never called.
我在这里想念什么?
推荐答案
我们已就此问题与Apple开发人员技术支持(DTS)联系. 他们回答说,这是Xcode 8中的 bug .
We contacted Apple Developer Technical Support (DTS) with this issue. They replied that this is a bug in Xcode 8.
我们提交了一个错误报告,希望能尽快进行更新. (Apple Bug报告ID:28315920).
We submitted a bug report and hope for a quick update. (Apple Bug Report ID: 28315920).
如果遇到类似的问题,请 ="a href =" https://bugreport.apple.com/"rel =" nofollow noreferrer>提交错误报告 (指的是我们的),因此Apple工程师认为它不是一个单独的案例.
If you experience a similar issue, please also file a bug report (referring to ours) so the Apple engineers see its not a single case.
针对Xcode≥8.1的更新
问题现在似乎已经解决,至少对于我们在项目中使用的委托方法而言.
The problem seems fixed now, at least for the delegate methods we are using in our project.
这篇关于Xcode 8警告“实例方法几乎符合可选要求"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!