2

I have a UIProgressView which is used to show to the user the progress of a file download. The download request is done in a background thread, and in the progress block, the UIProgressView progress value update is called on the main thread.

It works well to around 40%, but then it hangs and quickly shows up at around 100% and the custom alert closes (as it should). I tried multiple times but I can't get it to smoothly update to 100%.

I also have a cancel button, which I noticed that it doesn't respond to taps in that 40% - 100% range. So, somehow, the main thread gets blocked. Because in the 0% - 40% range, the cancel button works perfectly. I am very sure I don't block the main thread with the file download, and that the UIProgressView update is done on the main thread.

What could be the problem?

Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113

1 Answers1

2

I finally figured out why. It was because I had an NSLog call in the progress block which was called quite a lot.

I still don't understand why it did this, and why constantly at around 40%, but I think it's not a good idea to have it in production nonetheless.

Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113