I am creating a GCD dispatch queue to handle creating and saving new managed objects asynchronously.
Firstly, will it be necessary to create this as an instance variable? Say I have a (hypothetical) method -newObjectWithProperties:, and I created the queue locally with the label "com.myapp.coredata". The next time I call -newObjectWithProperties: and recreate the queue with the same label, BUT the previous background task on that queue was still incomplete, would the local ‘recreation’ of that queue correspond to the same actual queue? Or would it throw an exception? If the latter, then I presume a class-wide instance variable would be required for the queue.
Assuming an ivar is required, how should the memory management be handled for this? I guess that I would use dispatch_queue_create() in -init, and then simply call dispatch_release() in -dealloc?
I do something similar, but I create the queue once, and reuse that queue anytime I need to dispatch a background task. The queue is created the first time it’s needed (not in init) and stored in an ivar, then destroyed in dealloc.