<?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: Code: Reachability</title>
	<atom:link href="http://www.alexcurylo.com/blog/2009/05/01/code-reachability/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/</link>
	<description>Alex Curylo, iPhone Programmer</description>
	<lastBuildDate>Tue, 07 Feb 2012 06:22:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: DDG Reachability at Under The Bridge</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-2837</link>
		<dc:creator>DDG Reachability at Under The Bridge</dc:creator>
		<pubDate>Sun, 31 Jan 2010 05:53:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-2837</guid>
		<description>[...] as you no doubt know if you&#8217;ve been reading us for a while, your iPhone programs need to go figure out for themselves the status of the network connection [...]</description>
		<content:encoded><![CDATA[<p>[...] as you no doubt know if you&#8217;ve been reading us for a while, your iPhone programs need to go figure out for themselves the status of the network connection [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-1394</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 17 May 2009 08:16:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-1394</guid>
		<description>Problem with this sample is with the cache (reachabilityQueries). When we first set NetworkStatusNotificationsEnabled to NO then the value of SCNetworkReachabilityRef will be cached but if we chanaged notification to YES, the notification won&#039;t by registered in current run loop. 
In my solution I added property to the ReachabilityQuery - networkstatusnotificationenabled - and a method to the Reachability which I call after changing networkStatusNotification; the method:
- (BOOL)updateNetworkStatusNotification
{
	if (![self hostName] &#124;&#124; ![[self hostName] length]) {
		return NO;
	}
	ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:[self hostName]];
	if(cachedQuery.networkStatusNotificationsEnabled != [self networkStatusNotificationsEnabled]){
			 [cachedQuery scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
		 }
	 return YES;
}

so from client code we have:
	[[Reachability sharedReachability] setHostName:[self hostName]];
	[self updateStatus];
	[[Reachability sharedReachability] setNetworkStatusNotificationsEnabled:YES];
	[[Reachability sharedReachability] updateNetworkStatusNotification];</description>
		<content:encoded><![CDATA[<p>Problem with this sample is with the cache (reachabilityQueries). When we first set NetworkStatusNotificationsEnabled to NO then the value of SCNetworkReachabilityRef will be cached but if we chanaged notification to YES, the notification won&#8217;t by registered in current run loop.<br />
In my solution I added property to the ReachabilityQuery &#8211; networkstatusnotificationenabled &#8211; and a method to the Reachability which I call after changing networkStatusNotification; the method:<br />
- (BOOL)updateNetworkStatusNotification<br />
{<br />
	if (![self hostName] || ![[self hostName] length]) {<br />
		return NO;<br />
	}<br />
	ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:[self hostName]];<br />
	if(cachedQuery.networkStatusNotificationsEnabled != [self networkStatusNotificationsEnabled]){<br />
			 [cachedQuery scheduleOnRunLoop:[NSRunLoop currentRunLoop]];<br />
		 }<br />
	 return YES;<br />
}</p>
<p>so from client code we have:<br />
	[[Reachability sharedReachability] setHostName:[self hostName]];<br />
	[self updateStatus];<br />
	[[Reachability sharedReachability] setNetworkStatusNotificationsEnabled:YES];<br />
	[[Reachability sharedReachability] updateNetworkStatusNotification];</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: quack</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-1389</link>
		<dc:creator>quack</dc:creator>
		<pubDate>Sun, 17 May 2009 06:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-1389</guid>
		<description>there isn&#039;t a bug in apples code there&#039;s an issue with the sample. don&#039;t think the whole file was meant to be cut and pasted. use the SCNetwork functions they call in the example.</description>
		<content:encoded><![CDATA[<p>there isn&#8217;t a bug in apples code there&#8217;s an issue with the sample. don&#8217;t think the whole file was meant to be cut and pasted. use the SCNetwork functions they call in the example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: luk</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-1370</link>
		<dc:creator>luk</dc:creator>
		<pubDate>Sat, 16 May 2009 17:39:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-1370</guid>
		<description>Your solution helps as you described - but when I put this in my application I&#039;m not getting notification when connectivity was changed</description>
		<content:encoded><![CDATA[<p>Your solution helps as you described &#8211; but when I put this in my application I&#8217;m not getting notification when connectivity was changed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aatif</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-1021</link>
		<dc:creator>Aatif</dc:creator>
		<pubDate>Tue, 05 May 2009 09:58:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-1021</guid>
		<description>thanks, can u or somebody suggest the minimum required stuff to add a &#039;check&#039; for internet connectivity in my existing application?</description>
		<content:encoded><![CDATA[<p>thanks, can u or somebody suggest the minimum required stuff to add a &#8216;check&#8217; for internet connectivity in my existing application?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Robinson</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-947</link>
		<dc:creator>Paul Robinson</dc:creator>
		<pubDate>Sat, 02 May 2009 11:30:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-947</guid>
		<description>Nice tip.  Thanks for posting this.</description>
		<content:encoded><![CDATA[<p>Nice tip.  Thanks for posting this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iPhoneKicks.com</title>
		<link>http://www.alexcurylo.com/blog/2009/05/01/code-reachability/comment-page-1/#comment-946</link>
		<dc:creator>iPhoneKicks.com</dc:creator>
		<pubDate>Sat, 02 May 2009 08:23:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=705#comment-946</guid>
		<description>&lt;strong&gt;Detecting Networking Host Reachability...&lt;/strong&gt;

You&#039;ve been kicked (a good thing) - Trackback from iPhoneKicks.com - iPhone SDK links, community driven...</description>
		<content:encoded><![CDATA[<p><strong>Detecting Networking Host Reachability&#8230;</strong></p>
<p>You&#8217;ve been kicked (a good thing) &#8211; Trackback from iPhoneKicks.com &#8211; iPhone SDK links, community driven&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

