0
votes

When I declare a NSOperationQueue member in a UIView subclass, operations send to it won't execute. When the queue is declared in the AppDelegate however the same operations are executed. Any ideas?

[EDIT] Ah, fixed it. Problem was my queue initialization was in the initWithFrame, which isn't called when it wakes from a nib. So annoying that these messages to a nil object disappear in void.

Thanks!

1
We'll need a little more code to help! The fact that you declared it inside a UIView shouldn't make any difference at all; can you put a breakpoint inside your UIView to prove that the code is actually running? - deanWombourne
How do you initialize the queue? Can you show us some code? - diederikh
Also, why are you setting up an NSOperationQueue in a UIView? Control or processing logic really belongs in a controller, not a view class. - Brad Larson
Because it processes subviews of the view. The controller should only be concerned with calling the update method at the appropriate time. If all this code would move to the controller it would be bloated very quickly. In my opinion this is a disadvantage of the mvc pattern. - RickyA

1 Answers

0
votes

There's nothing to prevent an NSOperationQueue from running in a view. As long as you've properly initialized it and added operations to it.

I'd recommend putting a breakpoint on your initialization of the queue, just to make sure that's being execute.

If this doesn't help, add some code to this question and someone will help.