wkWebView加载请求失败,错误域= NSURLErrorDomain Code = -999

时间:2018-05-25 09:58:49

标签: ios swift wkwebview

WKWebView上加载网址

  

错误域= NSURLErrorDomain代码= -999"(null)"的UserInfo = {NSErrorFailingURLStringKey =" https://开头XXXXXXXXX&#34 ;,   NSErrorFailingURLKey =" https://开头XXXXXXXXX&#34 ;,   _WKRecoveryAttempterErrorKey =}

我总是得到这个错误但随机

1 个答案:

答案 0 :(得分:0)

-999错误代码表示NSURLErrorCancelled。

取消过去的请求时会发生这种情况。

func setupPlot() {
    let plot = AKNodeOutputPlot(mic, frame: audioInputPlot.bounds)
    plot.plotType = .rolling
    plot.shouldFill = true
    plot.shouldMirror = true
    plot.color = UIColor.blue
    audioInputPlot.addSubview(plot)
}

override func viewDidLoad() {
    super.viewDidLoad()

    AKSettings.audioInputEnabled = true
    mic = AKMicrophone()
    tracker = AKFrequencyTracker(mic)
    silence = AKBooster(tracker, gain: 0)
}
@objc func updateUI() {
        if tracker.amplitude > 0.1 {
        frequencyLabel.text = String(format: "%0.1f", tracker.frequency)

        var frequency = Float(tracker.frequency)
        while frequency > Float(noteFrequencies[noteFrequencies.count - 1]) {
            frequency /= 2.0
        }
        while frequency < Float(noteFrequencies[0]) {
            frequency *= 2.0
        }

        var minDistance: Float = 10_000.0
        var index = 0

        for i in 0..<noteFrequencies.count {
            let distance = fabsf(Float(noteFrequencies[i]) - frequency)
            if distance < minDistance {
                index = i
                minDistance = distance
            }
        }
        let octave = Int(log2f(Float(tracker.frequency) / frequency))
        noteNameWithSharpsLabel.text = "\(noteNamesWithSharps[index])\(octave)"
        noteNameWithFlatsLabel.text = "\(noteNamesWithFlats[index])\(octave)"
    }
    amplitudeLabel.text = String(format: "%0.2f", tracker.amplitude)
}