0
私はアプリを持っており、ユーザーはpdfファイルをダウンロードできます。私は最近4をalamofireに移動して3迅速な私は、ダウンロードが完了した後、PDFファイルを表示しようとするが、ここに私のコードです、それはRealm accessed from incorrect thread.
ダウンロードが完了した後、不正なスレッドからアクセスされた領域Swift 3
を投げる:
Alamofire.download(url, method: .get, encoding: JSONEncoding.default, to: destination)
.downloadProgress(queue: DispatchQueue.global(qos: .utility)) { progress in
DispatchQueue.main.async {
magazineObject.progressBarDownload = self.percentProgress
magazineObject.progressBarTitle = self.percentProgressNext.cleanValue
}
}
}
.validate { request, response, temporaryURL, destinationURL in
self.localPath = destinationURL
magazineObject.pathDatabase = String(describing: self.localPath!)
magazineObject.progressBarDownload = Double(self.percentProgressFinal)
magazineObject.progressBarTitle = Float(self.displayFinalLabelPercent).cleanValue
magazineObject.statusDarkViewAfterRelaunch = 1
magazineObject.statusDownload = self.statusDatabase
try! realm.write {
realm.add(magazineObject)
}
return .success
}
で詳細を確認することができます!まことにありがとうございます! –