Tutorial 1 BullsEye - Slider freezes after first 'Hit Me' - Closure handler seems to be the cause

You can call view.setNeedsDisplay() to update the view (and all its subviews) on the next redraw cycle. Only thing is, I don’t know if this will fix the issue since I am unable to replicate the issue using the code from any of the affected people at my end. The code runs fine on my simulator and I do not see the issue.

If you want to try too, you can certainly upload a ZIP file with the code and provide a link here and I’ll try again. But it appears to be either a timing issue or something obscure which happens only under certain circumstances and until I can replicate it, I’m unable to figure out what is going on.

Can you try the following code and let us know if the slider still freezes:

    let action = UIAlertAction(
        title: "OK",
        style: .default,
        handler: { _ in
            DispatchQueue.main.async {
                self.startNewRound()
            }
        }
    )

@geekomancer,

By the way, I just noticed that you have a stray 0 pixel by 0 pixel Label in your storyboard that is not within the View–in the View outline it’s the label under the ‘1’ label. I wonder if somehow that label could be causing the problems you are seeing. I discovered where the stray label was located by going into its Size Inspector and changing its size to 200x200.

So glad I found this thread. Been banging my head for a while now searching the web for answers as I was stuck with that cool update of the BullsEye app. Now I know a lot about closures!

And now I can move on! Not because I already have the solution but in knowing that somebody else is having this error. And Yes, it works using an actual device. I’m using Xcode 9.2, Simulator 11.2. Looking forward for the solution.

@7stud Thanks for finding that! I’ve been away for quite a while, but have been following the thread. (My work schedule is really erratic.)

The app seems to be working normally now. I got rid of that stray label, and also ran an OS update. Both seemed to help, and a few previous issues with Xcode projects seem to have disappeared.

Anyway, thanks for all your help.

This topic was automatically closed after 166 days. New replies are no longer allowed.