Re: NSOperation communicating progress?
Re: NSOperation communicating progress?
- Subject: Re: NSOperation communicating progress?
- From: Mike Abdullah <email@hidden>
- Date: Mon, 04 Feb 2013 23:09:02 +0000
On 4 Feb 2013, at 22:35, Todd Heberlein <email@hidden> wrote:
>
>> Again, everything seems to work fine. The one problem is I get the following warning at the very end:
>>
>> CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.
>
> To close out this discussion in case anyone runs across it in the future trying to debug the same thing. I had multiple errors, but the final one was that I had registered to be notified when my NSInvocationOperation finished.
>
> [myOp addObserver:self forKeyPath:@"isFinished" options:NSKeyValueObservingOptionNew context:NULL];
>
> And then in my method
>
> - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
>
> I closed a window that had an NSProgressIndicator. The problem is that the method is actually called not on the main thread (I think it was the thread created to process my NSInvocationOperation). Closing these GUI objects from this other thread seemed to be the final problem generating the warning above.
>
> I moved the code to another method, -finishedReadingAuditFile, and then created another NSInvocationOperation to call it on the main thread
>
> NSInvocationOperation *tmpOperation;
> tmpOperation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(finishedReadingAuditFile) object:nil];
> [[NSOperationQueue mainQueue] addOperation:tmpOperation];
Out of interest, is there any reason why you're shying away from blocks here? They make this sort of code much simpler to write.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden