Re: Crashing Problem calling postNotificationName
Re: Crashing Problem calling postNotificationName
- Subject: Re: Crashing Problem calling postNotificationName
- From: Dave <email@hidden>
- Date: Wed, 11 Sep 2013 12:35:33 +0100
Hi,
Sorry for the lack of data in my original post! I Found the problem it was a Notification being sent to a dead object, it didn't happen very often, one crash after over an hour running continuously. I was more worried about the data I was passing not belonging to same thread (I recently added this code) rather than one the object being dead. I thought my modifications had caused the crash, but actually it was there all along hiding!
Is there any problem with having all notifications handled by one object that doesn't go away, and have this ship the notificationa off to the correct object as long as it is still alive? The way this App is designed is I can tell if the object is allocated or not and if it is allocated, then I want it to receive notifications (In fact I ideally want it to get the last notifications sent regardless of if the receiver was dead or alive when the event occurred). At the moment I listen for the notification when the object is born and stop it listening when it dies. But when it it dies I have to save the data from the last notification somewhere and restore it when it is reincarnated. This is common to around 26 classes and I don't want to change all 26 to do the above, I'd rather the last value was remembered by the source of the notification and resent somehow on request.
Any ideas?
Cheers
Dave
On 10 Sep 2013, at 12:08, Dave <email@hidden> wrote:
> Hi,
>
> I have a crashing problem when calling postNotificationName, the following method is called from an Operation Queue method/thread. It is called on the Main Thread (the operation queue method, uses performSelectorOnMainThread which calls "parseOperationCompleted" below. I've tried copying theResultDictionary or just passing it in the dictionary as is, same result.
>
> Any ideas what could be causing the crash?
>
> -(void) parseOperationComplete:(NSDictionary*) theResultDictionary
> {
> myUserInfoDictionary = [[NSMutableDictionary alloc] init];
> [myUserInfoDictionary setObject:self.pUpdateString forKey:kUserInfoLiveUpdateString];
> [myUserInfoDictionary setObject:[theResultDictionary copy] forKey:kUserInfoLiveUpdateDictionary];
>
> [NSNotificationCenter defaultCenter] postNotificationName:kNotificationName object:self userInfo:myUserInfoDictionary];
> }
>
>
> Thanks in advance for any help!
>
> All the Best
> Dave
>
> _______________________________________________
>
> 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
_______________________________________________
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