Note that there are some explanatory texts on larger screens.

plurals
  1. PONSURL Connection will/won't load data
    primarykey
    data
    text
    <p>So here's my issue:</p> <p>I followed the <a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html" rel="nofollow noreferrer">NSURLConnection tutorial</a> in the iPhone Developer Documentation almost to the T, and it only kinda works.</p> <p>Here's where it all goes wrong:<br> The object seems to be created correctly and delegates to connectionDidFinishLoading, but with any URL I try to load the response data always ends up only being 0 bytes. I am running in the simulator if that makes any difference.</p> <p>Here's my relevant code: </p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.title = @"WVFS Player"; //create a request NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://wvfs.josh-kaplan.com/nowPlaying.php"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // create a connection NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(theConnection) { // create the datum responseData=[[NSMutableData data] retain]; } else { // code this later } } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [responseData setLength:0]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { // make it work NSLog(@"Succeeded! Received %d bytes of data:",[responseData length]); // release it [connection release]; [responseData release]; } </code></pre> <p>And here's my log output:</p> <pre><code>[Session started at 2010-03-14 09:01:09 -0400.] 2010-03-14 09:01:14.784 WVFS[19571:207] Succeeded! Received 0 bytes of data: </code></pre> <p>Any ideas? </p>
    singulars
    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. 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