Swift watchOS didReceiveMessage发出警告,我不明白

时间:2018-07-23 09:12:43

标签: apple-watch watch-os-2

func session(_ session: WCSession, didReceiveMessage message: [String : AnyObject]
    ,replyHandler: ([String : AnyObject]) -> Void
    ){
    print("Message received ")

    replyHandler(["Value":"Yes" as AnyObject])
}

得出warning的结果:

Instance method 'session(_:didReceiveMessage:replyHandler:)' nearly matches optional requirement 'session(_:didReceiveMessage:replyHandler:)' of protocol 'WCSessionDelegate'
Candidate has non-matching type '(WCSession, [String : AnyObject], ([String : AnyObject]) -> Void) -> ()'

Xcode 9.4.1 我在许多示例中都看到过code这个建议,但对我来说却失败了。有什么想法吗?

0 个答案:

没有答案