<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: NSNotification, UserInfo and Object Methods</title>
	<atom:link href="http://iPhoneDeveloperTips.com/cocoa/nsnotification-userinfo-and-object-methods.html/feed" rel="self" type="application/rss+xml" />
	<link>http://iPhoneDeveloperTips.com/cocoa/nsnotification-userinfo-and-object-methods.html</link>
	<description>iOS Developer Tips, Tricks and Tutorials.</description>
	<lastBuildDate>Wed, 08 Feb 2012 06:31:16 -0600</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Paulo Khouri</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/nsnotification-userinfo-and-object-methods.html#comment-23246</link>
		<dc:creator>Paulo Khouri</dc:creator>
		<pubDate>Wed, 11 Aug 2010 14:28:29 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=6450#comment-23246</guid>
		<description>Thanx, helped a lot =D</description>
		<content:encoded><![CDATA[<p>Thanx, helped a lot =D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/nsnotification-userinfo-and-object-methods.html#comment-19227</link>
		<dc:creator>Charlie</dc:creator>
		<pubDate>Thu, 08 Jul 2010 12:28:48 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=6450#comment-19227</guid>
		<description>Very good.</description>
		<content:encoded><![CDATA[<p>Very good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michelle</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/nsnotification-userinfo-and-object-methods.html#comment-18474</link>
		<dc:creator>Michelle</dc:creator>
		<pubDate>Thu, 01 Jul 2010 15:28:27 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=6450#comment-18474</guid>
		<description>Actually, the object method is a bit more complex than you suggest.  It does not give you the object that sent the notification; rather, it gives you whatever was assigned in postNotificationName:object.  This need not be the notifying object.

This allows a shortcut, albeit one that some developers would consider poor practice: instead of messing around with the userInfo parameter, just pass the data that the observer needs (an NSString, say) as the object.  So long as the relevant data is only a single object and the listeners don&#039;t need to specify a single object to listen to, this will work just fine.

The advantages of that approach are 1) a tiny increase in efficiency by not having to create the dictionary, release it, put an object into it and pull it out, 2) fewer lines of executable code, 3) not having to create a key that has no other purpose and expose it to both the senders and receivers.

Also note that there is some unfortunate coupling when you use the standard userInfo-related method:  you need a notification string and a set of notification key strings that have to be managed as a unit.

Ultimately, using the shortcut is a matter of taste.  I can understand the distaste some might have for it, but it has its uses.</description>
		<content:encoded><![CDATA[<p>Actually, the object method is a bit more complex than you suggest.  It does not give you the object that sent the notification; rather, it gives you whatever was assigned in postNotificationName:object.  This need not be the notifying object.</p>
<p>This allows a shortcut, albeit one that some developers would consider poor practice: instead of messing around with the userInfo parameter, just pass the data that the observer needs (an NSString, say) as the object.  So long as the relevant data is only a single object and the listeners don&#8217;t need to specify a single object to listen to, this will work just fine.</p>
<p>The advantages of that approach are 1) a tiny increase in efficiency by not having to create the dictionary, release it, put an object into it and pull it out, 2) fewer lines of executable code, 3) not having to create a key that has no other purpose and expose it to both the senders and receivers.</p>
<p>Also note that there is some unfortunate coupling when you use the standard userInfo-related method:  you need a notification string and a set of notification key strings that have to be managed as a unit.</p>
<p>Ultimately, using the shortcut is a matter of taste.  I can understand the distaste some might have for it, but it has its uses.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

