Error[8]: Undefined offset: 5, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述我将我的代码从 swift 3转换为 swift 4并在以下代码中获取此错误.即使我尝试使用flatmap来压平数组,我也会得到这个 Cannot convert value of type ‘String’ to expected argument type ‘String.Element’ (aka ‘Character’) if favoritedProducts.contains("hel 我将我的代码从 swift 3转换为 swift 4并在以下代码中获取此错误.即使我尝试使用flatmap来压平数组,我也会得到这个

Cannot convert value of type ‘String’ to expected argument type
‘String.Element’ (aka ‘Character’)

if favoritedProducts.contains("helloWorld") {}

下面的代码行不返回[String]而是返回'[String.Element]’如何将其转换为[String].如果我尝试将其转换为[String],它会说它总会失败.

let productIDs = allitems.flatMap{
struct Item {    let productID: String}
.productID}
如果您的Item类型具有类似String的非可选productID属性,请执行此 *** 作
let allitems: [Item] = ...

你有一个项目数组

let productIDs = allitems.map { [+++].productID }

然后,您可以使用map方法获取productID(s)数组

[+++]

现在productIDs是[String].

总结

以上是内存溢出为你收集整理的从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element全部内容,希望文章能够帮你解决从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Error[8]: Undefined offset: 6, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述我将我的代码从 swift 3转换为 swift 4并在以下代码中获取此错误.即使我尝试使用flatmap来压平数组,我也会得到这个 Cannot convert value of type ‘String’ to expected argument type ‘String.Element’ (aka ‘Character’) if favoritedProducts.contains("hel 我将我的代码从 swift 3转换为 swift 4并在以下代码中获取此错误.即使我尝试使用flatmap来压平数组,我也会得到这个

Cannot convert value of type ‘String’ to expected argument type
‘String.Element’ (aka ‘Character’)

if favoritedProducts.contains("helloWorld") {}

下面的代码行不返回[String]而是返回'[String.Element]’如何将其转换为[String].如果我尝试将其转换为[String],它会说它总会失败.

let productIDs = allitems.flatMap{
struct Item {    let productID: String}
.productID}
如果您的Item类型具有类似String的非可选productID属性,请执行此 *** 作
let allitems: [Item] = ...

你有一个项目数组

let productIDs = allitems.map { .productID }

然后,您可以使用map方法获取productID(s)数组

[+++]

现在productIDs是[String].

总结

以上是内存溢出为你收集整理的从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element全部内容,希望文章能够帮你解决从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element_app_内存溢出

从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element

从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element,第1张

概述我将我的代码从 swift 3转换为 swift 4并在以下代码中获取此错误.即使我尝试使用flatmap来压平数组,我也会得到这个 Cannot convert value of type ‘String’ to expected argument type ‘String.Element’ (aka ‘Character’) if favoritedProducts.contains("hel 我将我的代码从 swift 3转换为 swift 4并在以下代码中获取此错误.即使我尝试使用flatmap来压平数组,我也会得到这个

Cannot convert value of type ‘String’ to expected argument type
‘String.Element’ (aka ‘Character’)

if favoritedProducts.contains("helloWorld") {}

下面的代码行不返回[String]而是返回'[String.Element]’如何将其转换为[String].如果我尝试将其转换为[String],它会说它总会失败.

let productIDs = allitems.flatMap{
struct Item {    let productID: String}
.productID}
如果您的Item类型具有类似String的非可选productID属性,请执行此 *** 作
let allitems: [Item] = ...

你有一个项目数组

let productIDs = allitems.map { .productID }

然后,您可以使用map方法获取productID(s)数组

现在productIDs是[String].

总结

以上是内存溢出为你收集整理的从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element全部内容,希望文章能够帮你解决从swift 3迁移到swift 4 – 无法将String转换为期望的String.Element所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1030689.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存