superk589 / PrincessGuide

An unofficial iOS app for プリンセスコネクト!Re:Dive.
Apache License 2.0
157 stars 17 forks source link

编译出错 #10

Open flymyd opened 4 years ago

flymyd commented 4 years ago

Swift编译器在此处报错: /PrincessGuide-master/PrincessGuide/Model/Action/ChangeEnergyRatioAction.swift:18:26: Type of expression is ambiguous without more context

报错行具体代码为: children.map(.parameter.id).map { String($0 % 10) }.joined(separator: ", "),

superk589 commented 4 years ago

这个地方原本的代码是 children.map(\.parameter.id) 你应该是不小心把这个"\"删了

flymyd commented 4 years ago

我复制的时候出的问题。加了\也不行;appcode和xcode都无法编译通过。 尝试改为如下可以解决,但我本身没有使用过swift,不清楚会不会影响正常功能。 children.map{ _ in parent!.parameter.id}.map { String($0 % 10) }.joined(separator: ", "),

superk589 commented 4 years ago

建议使用最新的Xcode 11.5 这个语法老版本可能不支持 如果确实是不支持 可以将 children.map(\.parameter.id) 改为 children.map { $0.parameter.id }