I’m looking through some of the sample code for the Square Cam in Apple’s sample code. I want to replicate some of it’s functionality in a modern project using ARC. However, there are a ton of require statements such as:
BOOL success = (destination != NULL);
require(success, bail);
Which generates the compiler error:
Goto into protected scope.
My question is — what is the appropriate way to handle such statements in a project using ARC?
I had the same problem (with the same sample code). The code looked like this:
I added braces around the block with the declarations to make their scope clear:
And it solved the problem for me. Through looking at this I also learned you can sometimes expand build errors to get more detail.