Error Domain=kCFErrorDomainCFNetwork Code=-1009
<p>I'm developing an APP which downloads data from a URL. Randomly the error</p>

<blockquote>
  <p>"Error Domain=kCFErrorDomainCFNetwork Code=-1009" </p>
</blockquote>

<p>is shown. I know the error means I have lost Wifi connection. In fact, the wifi logo disappears from my Ipad. After turning off and on the WiFi the connection comes back and I can restart downloading data.
I noticed that if I use the AppStore or Safari while the connection is lost it reconnects automatically.
The question is: what should I do with my app to get the same behavior as AppStore or Safari so I can reconnect automatically?</p>