我正在使用此代码从服务器访问数据
NSString *post = [[NSString alloc] initWithFormat:@"Email=%@",GEmail];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSURL *url = [NSURL URLWithString:@"http://smads.in/day.php"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest setHTTPMethod:@"POST"];
[theRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPBody:postData];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if( theConnection )
{
webData = [[NSMutableData data] retain];
}
else
{
}
它稍微提取数据所以问题是 - 我有一个代码,用于检查从服务器获取的数据 -
If(flag==1)
NSlog(@"YES");
else
NSlog(@"NO");
当我第一次点击时,它会在我再次点击时打印NO,然后显示是。
我如何一键检查条件?
建议我,如果有任何想法.....
谢谢,
阿伦
答案 0 :(得分:0)
你可以做一件事。
在您收到请求的回复之前,不要让用户点击按钮。
您可以使用userinteraction属性