views:

27

answers:

1

hi,

i have this:

 - (IBAction)checkupdate
 { 
statusText.text = [[NSString alloc] initWithFormat:@"Checking......"];

everytime i press button, the string get display, ok no problem with that.

now when i add

NSURLRequest *theRequest = 
[NSURLRequest requestWithURL:
 [NSURL URLWithString:@"http:/myserver/version.plist"] 
                 cachePolicy:NSURLRequestUseProtocolCachePolicy
             timeoutInterval:5.0];    
NSURLResponse *response;
NSData *received = 
[NSURLConnection sendSynchronousRequest:theRequest 
                      returningResponse:&response error:&error];   

the string doesn't get display 1st. the NSURLRequest code is below the string display code all within the same action.

the string only display after the nsurlrequest is done.

isn't the displaying of the string suppose to execute 1st? i tried putting { , } to cover up the nsurlrequest, but still it get execute 1st.

any ideas?

+1  A: 

The value of the label has been set but the redraw of the label can only be done when the function exits and it's not guaranteed to happen right at the exit. Since your making your request synchronously, it can take a long time before it is redrawn.

Eric Fortin
hm...how can i make it appear immediately once button is press?
Stefan
Sendind the request asynchronously would surely reduce the time needed to display the new label text.
Eric Fortin