Note that there are some explanatory texts on larger screens.

plurals
  1. POInstructions in viewdidload not being taken care of
    primarykey
    data
    text
    <p>I am facing an annoying problem. I have an application who is basicly made of several methods: viewDidload, connection:didReceiveResponse, connection:didReceiveData...</p> <p>In my viewDidload, I define a NSURLRequest to a personal websiten, and right after and before it I added a label.text=@"xxx". I know the problem doesn't come from linking the label in IB because it used to display what I wanted. </p> <p>But now it seems none of those two label.text instructions are working even though I know my NSURLRequest works because the number of bytes received changes when I change the website... Why is that ? And I'm guessing the other instructions that come after aren't working either.</p> <p>I will give more details when I can in case anyone can enlighten me on this.</p> <p>Have a good day and thanks for your help</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; label.text=@"rrr"; request=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://mywebsite.aspx?example=5"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; label.text=@"aeza"; NSURLConnection *connection=[[NSURLConnection alloc] initWithRequest:request delegate:self]; if (connection) { receiveddata=[[NSMutableData data] retain]; label.text=@"NO BUG"; } else { label.text=@"BUG"; } datastring = [[NSString alloc] initWithData:receiveddata encoding:NSUTF8StringEncoding]; components=[datastring componentsSeparatedByString:@"|"]; label.text=datastring; [datastring release]; } -(void) connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response { [receiveddata setLength:0]; } -(void) connection: (NSURLConnection *)connection didReceiveData: (NSData *)data { [receiveddata appendData:data]; } -(void)connection: (NSURLConnection *)connection didFailWithError:(NSError *)error { [connection release]; [receiveddata release]; NSLog(@"Connection failed! Error - %@ %@", [error localizedDescription], [[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]); } -(void) connectionDidFinishLoading:(NSURLConnection *)connection { NSLog(@"Succeeded! Received %d bytes of data",[receiveddata length]); [connection release]; [receiveddata release]; } @end </code></pre>
    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.
 

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