最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]swift中用join出错:Value of type (_, _) -> _ has no member Distance

iOS crifan 596浏览 0评论

iOS的swift代码:

extension TCBlobDownload: CustomStringConvertible {

    public var description: String {

        var parts: [String] = []

        var state: String

       

        switch self.downloadTask.state {

            case .Running: state = "running"

            case .Completed: state = "completed"

            case .Canceling: state = "canceling"

            case .Suspended: state = "suspended"

        }

       

        parts.append("TCBlobDownload")

        parts.append("URL: \(self.downloadTask.originalRequest!.URL)")

        parts.append("Download task state: \(state)")

        parts.append("destinationPath: \(self.directory)")

        parts.append("fileName: \(self.fileName)")

       

        return join(" | ", parts)

    }

}

出错:

/Users/crifan/dev/dev_root/daryun/JianDao/iOS-Client/JianDao/TCBlobDownload.swift:168:16: Value of type ‘(_, _) -> _’ has no member ‘Distance’

自己改为:

extension TCBlobDownload: CustomStringConvertible {

    public var description: String {

        var parts: [String] = []

        var state: String

       

        switch self.downloadTask.state {

            case .Running: state = "running"

            case .Completed: state = "completed"

            case .Canceling: state = "canceling"

            case .Suspended: state = "suspended"

        }

       

        parts.append("TCBlobDownload")

        parts.append("URL: \(self.downloadTask.originalRequest!.URL)")

        parts.append("Download task state: \(state)")

        parts.append("destinationPath: \(self.directory)")

        parts.append("fileName: \(self.fileName)")

       

//        return join(" | ", parts)

        let joinedParts = parts.joinWithSeparator(" | ")

        return joinedParts

    }

}

即可解决问题。

转载请注明:在路上 » [已解决]swift中用join出错:Value of type (_, _) -> _ has no member Distance

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
63 queries in 0.101 seconds, using 18.80MB memory