【发布时间】:2020-05-20 11:40:49
【问题描述】:
我有以下由同事编写的 swift 代码。
我不知道斯威夫特。
我一直在 xcode 中运行“产品”->“存档”,以便可以发布到 App Store。
以下代码已经存在很长时间了,我没有更改它,但我现在收到错误“协议'数字'只能用作通用约束,因为它具有 Self 或关联类型要求”。
有谁知道问题出在哪里? ……你能解释一下吗?
非常感谢任何帮助。
import Foundation
func MyCallback(_ id: String, _ with: Any?) -> String{
return "My.callback('\(id)', \(with != nil ? with is Numeric ? with! : "'\(with!)'" : "void 0"));"
}
【问题讨论】: