Swift 中的字符串(contentsOfURL:) 3
String(contentsOfURL:) in Swift 3
之前的代码:
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:)
之前的代码:
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:)