내가 NSProgressIndicator (진행률 표시 줄)가 함께 함수 내에서 작동하지 : 콜백과 함수 내부에 위치NSProgressIndicator는 같은 대리자 메서드 내에서 때 완벽하게 작동하는 것 같다 콜백
func restClient(client: DBRestClient!, uploadProgress progress: CGFloat, forFile destPath: String!, from srcPath: String!) {
if progress == 1.0 {
progressBar.hidden = true
generalAlert("Uploaded", text: "Your File has been saved to your computer and uploaded under: \(destPath)")
} else {
progressBar.hidden = false
print(progress) // e.g 0.010213
progressBar.doubleValue = Double(progress)*100
}
}
그러나
, I 어떤 식 으로든 그것을 수정할 수있는 것 같지 않습니다 (내 isHidden = false 호출도 doubleValue 업데이트도 허용하지 않습니다).
CloudConvert.convert([
"inputformat": "gif",
"outputformat" : "mov",
"input" : "upload",
"file": name],
progressHandler: { (step, percent, message) -> Void in
print(percentage!) //e.g 10.31451. Called every second
self.progressBar.hidden = false //Doesn't Work
self.progressBar.doubleValue = Double(percentage!) //Doesn't Work
},
completionHandler: { (path, error) -> Void in
if(error != nil) {
self.progressBar.hidden = true
self.generalAlert("ERROR", text: "Your file could not be uploaded")
} else {
self.progressBar.hidden = true
self.generalAlert("MOV Uploaded", text: "Your MOV has been saved to your computer and uploaded")
}
})
아무도 왜 이런 생각 일 수 있습니까?
콜백이 주 스레드에 있는지 확인 하시겠습니까? –
나는 아니었다! 그 대답이었다! 당신이 그것을 받아 들일 수 있도록 대답이 아닌 주석으로 써 주시겠습니까? –