I'm developing an application in which I access data from the server through php. I use NSURLConnection for that. The data is fetched successfully, but there is some delay.
I'll describe in detail.
I want this:
When the user clicks the button, then send a request automatically to the server and receive the response from the server and display the response in an alert view.
The problem is:
I check the response in an if
condition:
If(flag==1)
NSLog(@"%@",YES);
else
NSLog(@"%@",NO);
But problem is that when the user clicks for the first time, then it prints NO
. When clicked again, then it prints YES
.
How can I solve this?