Re: Adding an observer to an NSOperation crashes my app.
Re: Adding an observer to an NSOperation crashes my app.
- Subject: Re: Adding an observer to an NSOperation crashes my app.
- From: G S <email@hidden>
- Date: Sat, 14 Jan 2012 13:25:26 -0800
Thanks, Mike.
There's nothing in the console. The whole call stack at the time of
the crash is this (when I create the operation on the main thread):
#0 0x00396336 in -[NSOperation observationInfo] ()
#1 0x0036823a in _NSKeyValueRetainedObservationInfoForObject ()
#2 0x00379c98 in -[NSObject(NSKeyValueObserverRegistration)
_addObserver:forProperty:options:context:] ()
#3 0x0037870d in -[NSObject(NSKeyValueObserverRegistration)
addObserver:forKeyPath:options:context:] ()
#4 0x000065e9 in __70-[StashpixAppDelegate
observeValueForKeyPath:ofObject:change:context:]_block_invoke_0
#5 0x01aae445 in _dispatch_call_block_and_release ()
#6 0x01ab04f0 in _dispatch_main_queue_callback_4CF ()
#7 0x01f51833 in __CFRunLoopRun ()
#8 0x01f50db4 in CFRunLoopRunSpecific ()
#9 0x01f50ccb in CFRunLoopRunInMode ()
#10 0x022d8879 in GSEventRunModal ()
#11 0x022d893e in GSEventRun ()
#12 0x00d6fa9b in UIApplicationMain ()
Here's the code again. Now I've enclosed it in a block to put in on
the main thread, but it still crashes on addObserver. I've examined
the operation just before that call, and all of its contents look
legit.
dispatch_async(dispatch_get_main_queue(), ^
{
GetMessagesOperation* msgOp = [[GetMessagesOperation alloc]
initWithUserID:_user.getID()
sinceLast:true
includeSystem:true
includeUser:false
skipRows:0
maxCount:50
DBManager:_pDatabaseMgr];
[msgOp addObserver:self forKeyPath:@"isFinished" options:0
context:getMessageContext];
[_operationQueue addOperation:msgOp];
[msgOp release];
});
_______________________________________________
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