我试图查看我的变量是否等于0或1,但是即使我的else
为0并且必须等于0,它也会立即进入我的NSString
语句。 / p>
在这种情况下,数据字符串为1。
NSString *udid =[[UIDevice currentDevice] identifierForVendor].UUIDString;
NSURL *targetURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://link.com/pay/test.php?udid=%@", udid]];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *dataString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
if([dataString isEqualToString:@"1"]){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"notpaid"
message:dataString
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"paid"
message:dataString
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}