This is the mistake:
incompatible pointer to integer conversion sending 'NSString*' to parameter of type 'BOOL' (aka 'signed char')
I don't know what to do. Please show me my mistake.
{
NSString *post =[NSString stringWithFormat:@"username=%@&password=%@",Name.text, Passwort.text];
NSString *hostStr = @"www....de.php";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
BOOL loggedIn = [serverOutput isEqualToString: @"YES"];
if (loggedIn)
{
[_LOGIN setEnabled:@"YES"];
}
else
{
[_LOGIN setEnabled:@"NO"];
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Benutzername oder Passwort falsch"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
}
}
_LOGIN.enabled = loggedIn;
if (!loggedIn)
{
UIAlertView *alertsuccess = [[UIAlertView alloc] ...];
}
Here :
if (loggedIn)
{
[_LOGIN setEnabled:@"YES"];
}
else
{
[_LOGIN setEnabled:@"NO"];
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Benutzername oder Passwort falsch"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
}
Don't use @"YES" or @"NO" when you call setEnabled method from the _LOGIN object. You should use YES OR NO :
[_LOGIN setEnabled:YES];
setEnbaled method need a boolean value as parameter, and when you sent @"YES" you send a string value to the method, that is not correct (since the method need boolean value).
[_LOGIN setEnabled:@"YES"];
Should be
[_LOGIN setEnabled:YES];
You are using an NString to set what I assume is a BOOL value. The same also applies to the bit where you set it as NO also.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.