Open danya0365 opened 8 years ago
This may not be limited to alamofire. I am having UI unresponsiveness, when the complete block of KVNProgress.dismiss(completion: {}) is fired. If I dismiss it with KVNProgress.dismiss() there does not seem to be an issue. I am hitting the network when this happens so maybe it is related to that. But I am not using Alamofire anywhere in the app.
I'm also experiencing seemingly random app freezes since migrating to Swift 3, but some of my users are experiencing this pretty often. I'm using KVNProgress heavily, so I will try to reproduce as you described.
So I removed KVNProgress from my project. No more complaints since then, so it is definitly an issue of this library. I use KVNProgress mostly to show success or error. Hope there will be a fix soon, as this is by far the best library!
I'm narrowing down the cause of this bug and I think it actually is a result of calling dismiss() multiple times, or more specifically calling dismiss() when there is no kvnprogressview visible.
👍
I was able to fixed this issue (in my case) by adding a .dismiss()
before a .showError()
.
KVNProgress.show(0.5)
KVNProgress.dismiss() <= Add dismiss between show and showError
KVNProgress.showError()
Today i already fixed by check isVisible before show other KVNProgress
example
KVNProgress.show()
after that before recall just check previous.
if KVNProgress.isVisible() {
KVNProgress.dismiss(completion: {
KVNProgress.show()
})
} else {
KVNProgress.show()
}
I created KVNManager to wrapped KNV library to manage it before show or dismiss.
class KVNProgressManager: NSObject {
static func applyConfig() {
let configuration = KVNProgressConfiguration()
configuration.minimumDisplayTime = 3.0
configuration.minimumSuccessDisplayTime = 3.0
configuration.minimumErrorDisplayTime = 3.0
KVNProgress.setConfiguration(configuration)
}
static func show() {
if KVNProgress.isVisible() {
KVNProgress.dismiss(completion: {
KVNProgress.show()
})
} else {
KVNProgress.show()
}
}
static func dismiss() {
if KVNProgress.isVisible() {
KVNProgress.dismiss()
}
}
static func dismiss(withCallback callback: @escaping () -> ()) {
if KVNProgress.isVisible() {
KVNProgress.dismiss(completion: {
callback()
})
} else {
callback()
}
}
static func showError(withStatus status: String) {
if KVNProgress.isVisible() {
KVNProgress.dismiss(completion: {
KVNProgress.showError(withStatus: status)
})
} else {
KVNProgress.showError(withStatus: status)
}
}
static func showSuccess(withStatus status: String) {
if KVNProgress.isVisible() {
KVNProgress.dismiss(completion: {
KVNProgress.showSuccess(withStatus: status)
})
} else {
KVNProgress.showSuccess(withStatus: status)
}
}
}
Issue still exist with alamofire . Can anyone help on this .
Call
KVNProgress.show(0.0, status: "Logging...")
in main threadthen in alamofire
request.responseJSON { (response:DataResponse<Any>) in
call
DispatchQueue.main.async { KVNProgress.showSuccess() }
orKVNProgress.showSuccess()