在Swift中,我有一个函数将一个数组传递给数组,然后在另一个函数中使用该数组。我不断收到此错误:无法将类型'Array [String]'的值转换为期望的参数类型'Set <String>'
Cannot convert value of type 'Array[String]' to expected argument type 'Set<String>'
@objc func getProductInfo(productIDs: Array<String>) -> Void {
print(productIDs) //this works with correct data
SwiftyStoreKit.retrieveProductsInfo(productIDs) { result in
...
其余的工作,当我通过在["Monthly", "Yearly", "etc..."]
规则阵列进行测试。
什么'SwiftyStoreKit.retrieveProductsInfo()'的声明看起来像? –
@RemyLebeau是一个接受产品ID的数组的函数。当我有阵列[“每月”,“每年”]硬输入它没有问题。试图通过我的应用动态地传递一个数组。 – Dan
这不是我问的。 'retrieveProductsInfo()'的**实际**声明是什么?很显然,它期望的不是你给的东西,否则你不会得到错误。 –