Hi all. Working on an iPhone app and encountered a stumper. I have various kinds of operations (derived from NSOperation) to do async queries over the Internet. As is the norm, I determine when they're finished by observing their isFinished property, and getting the results in observeValueForKeyPath (which as you may know is called in a secondary thread). This works great all over my app. Except...
When one particular type of operation finishes, I want to create a follow-up type of operation using info from the first. But when I do so, calling addObserver on the operation crashes my app with a bad access. Since observeValueForKeyPath is called in a secondary thread, I tried creating the follow-up operation and setting the observer on the main thread. Didn't help. This is being done in observeValueForKeyPath: *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];* The context is a void* to a string; I use the same syntax for many other operations that work fine. Here's how the contexts are defined: *static void* systemInfoContext = (void*)@"sys"; static void* validateUserContext = (void*)@"user"; static void* getMessageContext = (void*)@"msg";* It crashes instantly on that addObserver call. Anybody have a guess here? Thanks! Gavin _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com