내 블록에 진행 타이머를 구현할 때 질문 제목에 오류가 표시되는 이유를 정확히 인식하는 데 문제가 있습니다.Swift : 추가 인수 "progressblock"을 호출합니다.
func uploadImage(imageData: NSData!) {
let imageFile = PFFile(name: "\(PFUser.currentUser().username)'s Avatar", data: imageData)
// Show the HUD to prompt user of upload
hud = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
hud.mode = MBProgressHUDModeDeterminateHorizontalBar
hud.labelText = "Changing Image..."
// Upload the image
imageFile.saveInBackgroundWithBlock({ (succeeded: Bool, error: NSError!) -> Void in
// Check there was no error, begin handling the file upload
// trimmed out un-necessary code
}, progressBlock: { (amountDone: Int32) -> Void in
self.hud.progress = amountDone/100 as Float
})
}
내가 그러나 progressBlock
내에서 무엇을 가하고, 나는 예상대로 self.hud.progress = amountDone/100 as Float
모든 작품 행을 제거하면 충돌이 내 응용 프로그램을 발생합니다.
저는 Parse tutorial for uploading images을 따르고 있습니다. 차이점은 Swift와 작업 중이므로 Objective-C에서 변환 할 필요가 있습니다. 그러나 두 번째 구문을 작성하는 데 구문에서 큰 차이가 나는 이유는 알 수 없습니다. 블록.
플로트'는 내 표현과 똑같을거야 - 나쁘다 ... 감사합니다 캄 파이 – Alex