Ios 无法转换类型为';[CustomObject]';到预期的参数类型';["]和"x27 ;;
这是类声明:Ios 无法转换类型为';[CustomObject]';到预期的参数类型';["]和"x27 ;;,ios,swift,xcode,generics,swift3,Ios,Swift,Xcode,Generics,Swift3,这是类声明: class VXDropdownFormRow<T: SelectableOption>: DropdownFormRow<T> where T: Equatable { override init(title: String?, options: [T], selectedOption: T?, cellSelection: FormCellSelectionClosureType?, valueChanged: ((FormRow) ->
class VXDropdownFormRow<T: SelectableOption>: DropdownFormRow<T> where T: Equatable {
override init(title: String?, options: [T], selectedOption: T?, cellSelection: FormCellSelectionClosureType?, valueChanged: ((FormRow) -> Void)?) {
super.init(title: title, options: options, selectedOption: selectedOption, cellSelection: cellSelection, valueChanged: valueChanged)
self.cellHeight = 74
}
}
符合协议SelectableOption
,如类声明中所述:
open class ListItem: NSManagedObject, SelectableOption {
func setValues(fromJSON json: JSON, sortOrder: Int) {
defaultValue = json["default"].stringValue == "true" ? (true) : (false)
value = json["value"].stringValue
text = json["text"].stringValue
localSortOrder = (sortOrder as NSNumber?)
}
public func selectableOptionTitle() -> String {
return self.text!
}
public func selectableOptionSectionTitle() -> String {
return ""
}
}
但是编译器在生成时抛出一个错误:
Cannot convert value of type '[ListItem]' to expected argument type '[_]'
我应该做什么来修复此错误 我通过修复文件中设置为
VXDropdownFormRow
的原始声明,解决了这个问题。请检查申报单,确保一切正常。此错误具有误导性,无法帮助您发现问题 您是否尝试过VXDropdownFormRow(标题:…)
?没有帮助。同样的错误。
Cannot convert value of type '[ListItem]' to expected argument type '[_]'