• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: crash when using notification center and self
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash when using notification center and self


  • Subject: Re: crash when using notification center and self
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 6 Jun 2006 08:56:58 -0700

On Jun 5, 2006, at 11:01 PM, Tyler Riddle wrote:
[[NSNotificationCenter defaultCenter]
postNotificationName:@"MBModelStateChanged" object:self
userInfo:info];

results in a SIGSEGV

My model is going to post notifications which the controller picks up
- I'm calling that code from the model and I have multiple models so I
need to be able to pay attention to only the right one at the right
time.

Is it wrong to pass "self" as the object when posting a notification?

Nope -- self works fine. The 'object:' parameter is used to only notify observers of that specific object for that specific notification (or observers that are interested in all instances of the notification).


Likely, you have registered an observer that was observing just notifications to 'self' that was released without first being removed from the notification center as an observer.

The notification center does not retain observers and, therefore, if an observer is released without first being removed as an observer from the notification center, you'll see crashes just like this.

b.bum

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: crash when using notification center and self
      • From: "Pierce T. Wetter III" <email@hidden>
    • Re: crash when using notification center and self
      • From: j o a r <email@hidden>
References: 
 >crash when using notification center and self (From: "Tyler Riddle" <email@hidden>)

  • Prev by Date: Re: stringWithContentsOfURL: usedEncoding: error:
  • Next by Date: Drive mounting problem
  • Previous by thread: Re: crash when using notification center and self
  • Next by thread: Re: crash when using notification center and self
  • Index(es):
    • Date
    • Thread