<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Carl Mangold &#187; tip</title>
	<atom:link href="http://www.mangold.nl/tag/tip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mangold.nl</link>
	<description>Flash &#38; iPhone coding &#38; concepting</description>
	<lastBuildDate>Tue, 15 Jun 2010 10:23:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tip: Gegarandeerd verbinding</title>
		<link>http://www.mangold.nl/2009/09/tip-gegarandeerd-verbinding/</link>
		<comments>http://www.mangold.nl/2009/09/tip-gegarandeerd-verbinding/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 11:23:57 +0000</pubDate>
		<dc:creator>Carl Mangold</dc:creator>
				<category><![CDATA[Obj-C tips]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[obj-c]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=1</guid>
		<description><![CDATA[Op het Vodafone 3G netwerk krijg je vaak pas verbinding nadat je je app een keertje uit en terug aan hebt gezet. En dat is natuurlijk bijzonder vervelend.
Met een Auto Retry los je dit probleem doeltreffend op:
]]></description>
			<content:encoded><![CDATA[<p style="padding-top: 0px; margin-top: 0px; margin-bottom: 11px;">Op het Vodafone 3G netwerk krijg je vaak pas verbinding nadat je je app een keertje uit en terug aan hebt gezet. En dat is natuurlijk bijzonder vervelend.</p>
<p style="padding-top: 0px; margin-top: 0px; margin-bottom: 11px;">Met een Auto Retry los je dit probleem doeltreffend op:</p>
<p style="padding-top: 0px; margin-top: 0px; margin-bottom: 11px;"><div><div class="wp-synhighlighter-expanded"><a name="#NSURLConnection Auto Retry"></a><a style="wp-synhighlighter-title" href="#NSURLConnection Auto Retry"  onClick="javascript:wpContainer=this.parentNode.parentNode.getElementsByTagName('div')[1];	if(wpContainer.style.display=='none') {wpContainer.style.display=''; this.parentNode.className='wp-synhighlighter-expanded'} 	else {wpContainer.style.display='none'; this.parentNode.className='wp-synhighlighter-collapsed'}">NSURLConnection Auto Retry</a></div><div class="wp-synhighlighter-inner"><pre class="objc" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>verversGegevens</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    self.navigationItem.rightBarButtonItem <span style="color: #002200;">=</span> _reloadButtonItemWithActivity;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>_propellortje<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#91;</span>_propellortje startAnimating<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#91;</span>self.tableView setAlpha<span style="color: #002200;">:</span>.5<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    _retryCount <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#91;</span>_connection cancel<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    self.request <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> requestWithURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span>_remotePath<span style="color: #002200;">&#93;</span> cachePolicy<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span> timeoutInterval<span style="color: #002200;">:</span><span style="color: #2400d9;">5</span><span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    self.connection <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/"><span style="color: #400080;">NSURLConnection</span></a> alloc<span style="color: #002200;">&#93;</span> initWithRequest<span style="color: #002200;">:</span>_request delegate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #6e371a;">#pragma mark --- NSURLConnection delegate methods ---</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/"><span style="color: #400080;">NSURLConnection</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection didFailWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span style="color: #400080;">NSError</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>_retryCount<span style="color: #002200;">++</span> &lt; <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #002200;">&#91;</span>_connection cancel<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        self.request <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> requestWithURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span>_remotePath<span style="color: #002200;">&#93;</span> cachePolicy<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span> timeoutInterval<span style="color: #002200;">:</span><span style="color: #2400d9;">15</span><span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        self.connection <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/"><span style="color: #400080;">NSURLConnection</span></a> alloc<span style="color: #002200;">&#93;</span> initWithRequest<span style="color: #002200;">:</span>_request delegate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Connection error -&gt; RETRY&quot;</span><span style="color: #002200;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #a61390;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        self.navigationItem.rightBarButtonItem <span style="color: #002200;">=</span> _reloadButtonItem;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #002200;">&#91;</span>_propellortje stopAnimating<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #002200;">&#91;</span>_propellortje removeFromSuperview<span style="color: #002200;">&#93;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Connection error %@&quot;</span>, error<span style="color: #002200;">&#41;</span>; </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #11740a; font-style: italic;">//TODO: foutmelding naar gebruiker</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #002200;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #002200;">&#125;</span></div></li></ol></pre></div></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangold.nl/2009/09/tip-gegarandeerd-verbinding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
