I have an iOS app with which I was previously using performSelectorInBackground to open a persistent socket connection. However, according to this answer, one should never use performSelectorInBackground.
The alternative, GCD and NSOperationQueue, both appear to persist the full stack frame, including 4! separate context switches, when I pause my app in the debugger. Therefore, if I open a socket connection inside a particular deep stack, that stack will persist for the lifetime of my app.
Are there any downsides to this? Here is what my stack looks like when I call my own internal beginSocketConnection
:
Before, my call to beginSocketConnection
was always (basically) at the top of a very simple stack because it had been invoked by performSelectorInBackground
. That looked nicer/cleaner/better to me, so I'm not sure if this new approach is a bad thing.