gpt4 book ai didi

swift - 字符串(contentsOfURL :) in Swift 3

转载 作者:搜寻专家 更新时间:2023-10-30 22:30:44 24 4
gpt4 key购买 nike

之前的这段代码:

if let resultOfURL = try? String(contentsOfURL:myURL!, encoding: String.Encoding.utf8) {

现在抛出这个错误:

'init' has been renamed to 'init(describing:)'

有什么帮助吗?非常感谢!!

最佳答案

根据 the Swift 3 Migration Guide ,

Users may need to manually migrate calls to String(contentsOfURL:usedEncoding:) to String(contentsOf:usedEncoding:)

关于swift - 字符串(contentsOfURL :) in Swift 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39089259/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com