【问题标题】:"The file “command.cgi” couldn’t be opened."“无法打开文件‘command.cgi’。”
【发布时间】:2019-10-09 13:26:17
【问题描述】:

FlashAir W-04 第四代 SD 存储卡

在我的 iOS 应用目录中列出的 api 不起作用。

回应:

任务。 HTTP 加载失败(错误代码:-1003 [12:8])

2019-05-21 23:32:40.267572+0530 Razzo[10489:87069] NSURLConnection 完成错误 - 代码 -1003

Error Domain=NSCocoaErrorDomain Code=256 "无法打开文件“command.cgi”。"用户信息={NSURL=http://flashair/command.cgi?op=100&DIR=/DCIM}

请帮我看看有什么问题

下面的代码sn-p

private func getdata() {
        let url100 = URL(string: "http://flashair/command.cgi?op=100&DIR=/DCIM")
        var dirStr: String? = nil
        do {
            if let url100 = url100 {
                dirStr = try String(contentsOf: url100, encoding: String.Encoding(rawValue: String.Encoding.utf8.rawValue))
                if let dir = dirStr {
                    arrayfiles = dir.components(separatedBy: "\n")
                }
                tblContent.reloadData()
            }
        } catch {
            print(error)
            self.displayAlert(message: error.localizedDescription)
        }
}

下面的配置文件

[供应商]

CIPATH=/DCIM/100__TSB/FA000001.JPG

APPMODE=4

APPNETWORKKEY=12345678

VERSION=F15DBW3BW4.00.03

CID=02544d535733324755e3c6dc7b012301

PRODUCT=FlashAir

供应商=东芝

MASTERCODE=f437b71e0e4f

LOCK=1

【问题讨论】:

    标签: ios swift flashair


    【解决方案1】:

    contentsOf: url100 将用于本地文件 URL。您没有提供有效的文件 URL。

    如果您的文件是远程文件,您需要使用 URLSession 将文件作为数据下载。如果它是本地的,您需要计算出它的文件 URL。

    【讨论】:

    猜你喜欢
    • 2019-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-30
    • 2015-10-16
    • 2018-08-15
    • 2016-05-25
    相关资源
    最近更新 更多