Re: NSAlert boxes ...
That’s exactly what I’m saying - you are taking ownership of it with alloc+init.
Then you release it or autorelease it within the scope of setting it up. Normal rules.
But the point is the alert is run asynchronously, so it has to survive long after the scope of where you instantiated and set it up. Long after the next autorelease drain in fact. But that is someone else's problem - the run-loop’s, I’m supposing.
The alternative is to try to take ownership of it until it is finally and completely dismissed, which requires an unbalanced release in the completion block. This not only flags a warning when you compile, but it’s simply unnecessary. Trying to overthink the ownership rules in this case leads to code that is not only complicated, but redundant. The designers of NSAlert have already taken its lifetime into consideraton, so YOUR ownership of it only lasts as long as it takes to instantiate it, set it up, and ask it to run modally.
Peter’s original code, where he autoreleases as part of alloc + init, works absolutely fine.