Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've been dealing with this same question for a while now...</p> <ol> <li><p>If you're effectively doing a GET on a simple resource, and you're confident that the resource will always be there &amp; accessible, there's an easy way to do it:</p> <pre><code>NSURL *URL=[[NSURL alloc] initWithString:@"http://www.google.com/"l]; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; //TODO This needs to have timeouts &amp; such set up, maybe parallelism NSString *results = [[NSString alloc] initWithContentsOfURL :URL]; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; </code></pre> <p>That's a REALLY simple way to do it, but as my comment says, not very robust or reliable.</p></li> <li><p>A slightly more robust, yet still reasonably simple, is replacing the NSString line with:</p> <pre><code>results = [[NSString alloc] initWithContentsOfURL:URL encoding:NSASCIIStringEncoding error:&amp;err]; // possibly NSUnicodeStringEncoding if (err!=nil) NSLog(@"Error occurred: %@", [err localizedDescription]); </code></pre> <p>That will at least TELL you if there's an error...</p></li> <li><p><code>ASIHTTPRequest</code> provides a lot of neat &amp; useful network functionality for dealing with resources over the internet. <a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow noreferrer">http://allseeing-i.com/ASIHTTPRequest/</a> - the developer has been VERY responsive on his Google Group. I really wanted to use that, and may get back to it when/if it supports SSL Client Certificate authentication (which is what my project requires).</p></li> <li><p><code>NSURLConnection</code>, as described above - that's what I'm using now in my project. I would imagine that this will satisfy almost all needs, but it's (in my opinion) more tricky to use. And to be honest, I'm still having a little trouble wrapping my mind around how to integrate asynchronous data loading into my application. But if it will work for you - and it probably will, Apple is using it all over the OS and its apps - that's your best bet!</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload