Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created September 6, 2012 15:13
Show Gist options
  • Select an option

  • Save lukeredpath/3657222 to your computer and use it in GitHub Desktop.

Select an option

Save lukeredpath/3657222 to your computer and use it in GitHub Desktop.
NSOperation *op1 = /* get operation */;
NSOperation *op2 = /* get operation */;
[op1 addDependency:op2];
[queue addOperation:op1];
[queue addOperation:op2];
// op1 seems to run before op2, and if I don't add op2, op1 runs anyway
@lukeredpath

Copy link
Copy Markdown
Author

Breakpoint inside op1's start method:

(lldb) print (BOOL) [[[self dependencies] objectAtIndex:0] isSuccessful]
(BOOL) $13 = NO
(lldb) print (BOOL) [[[self dependencies] objectAtIndex:0] isReady]
(BOOL) $14 = YES
(lldb) print (BOOL) [[[self dependencies] objectAtIndex:0] isFinished]
(BOOL) $15 = NO
(lldb) print (BOOL) [[[self dependencies] objectAtIndex:0] isStarted]
(BOOL) $16 = NO
(lldb) print (BOOL) [[[self dependencies] objectAtIndex:0] isExecuting]

@lukeredpath

Copy link
Copy Markdown
Author

Fixed it - NSOperation subclass was defining isReady without calling super.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment