简体   繁体   English

整数转换的不兼容指针,将“ NSString *”发送到“ BOOL”类型的参数(又名“ signed char”)

[英]incompatible pointer to integer conversion sending 'NSString*' to parameter of type 'BOOL' (aka 'signed char')

This is the mistake: 这是错误的:

incompatible pointer to integer conversion sending 'NSString*' to parameter of type 'BOOL' (aka 'signed char') 整数转换的不兼容指针,将“ NSString *”发送到“ BOOL”类型的参数(又名“ 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. 从_LOGIN对象调用setEnabled方法时,请勿使用@“ YES”或@“ NO”。 You should use YES OR NO : 您应该使用YES或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). setEnbaled方法需要一个布尔值作为参数,并且当您发送@“ YES”时,会向该方法发送一个字符串值,这是不正确的(因为该方法需要布尔值)。

[_LOGIN setEnabled:@"YES"]; [_LOGIN setEnabled:@“是”];

Should be 应该

[_LOGIN setEnabled:YES]; [_LOGIN setEnabled:YES];

You are using an NString to set what I assume is a BOOL value. 您正在使用NString设置我假设的BOOL值。 The same also applies to the bit where you set it as NO also. 将其设置为“否”的位也相同。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 与指针转换不兼容的整数将'NSInteger'(又名'int')发送到'NSInteger *'类型的参数(又名'int *') - Incompatible Integer to pointer conversion sending 'NSInteger' (aka 'int') to parameter of type 'NSInteger *' (aka 'int *') 不兼容的整数转换指针将“NSIndexPath *__strong”发送到“NSUInteger”类型的参数(又名“unsigned long”) - Incompatible pointer to integer conversion sending 'NSIndexPath *__strong' to parameter of type 'NSUInteger' (aka 'unsigned long') 指向整数转换的不兼容指针,将“ void *”发送到“ PHImageContentMode”类型的参数(又称为“枚举PHImageContentMode”) - Incompatible pointer to integer conversion sending 'void *' to parameter of type 'PHImageContentMode' (aka 'enum PHImageContentMode') 指针转换不兼容的整数,向“ uilabel”类型的参数发送“ int” - Incompatible integer to pointer conversion sending 'int' to parameter of type uilabel 与整数转换不兼容的指针将'void *'发送到'NSJSONReadingOptions'类型的参数 - Incompatible pointer to integer conversion sending 'void *' to parameter of type 'NSJSONReadingOptions' 向整数转换发送不兼容的指针,将“ NSNumber *”发送到“ long”类型的参数 - Incompatible pointer to integer conversion sending 'NSNumber *' to parameter of type 'long' 不兼容的指向整数转换的指针,将“ id”发送到“ int”类型的参数 - Incompatible pointer to integer conversion sending 'id' to parameter of type 'int' 不兼容的指针类型将'int'发送到'va_list'类型的参数(又名'char') - Incompatible pointer types sending 'int' to parameter of type 'va_list' (aka 'char') 不兼容的指针类型将'NSURL * __ strong'发送到类型'NSString *'的参数 - Incompatible pointer types sending 'NSURL *__strong' to parameter of type 'NSString *' 错误消息:整数转换的不兼容指针,将“ NSArray * __ strong”发送到“ NSUInteger”类型的参数 - Error Message: Incompatible pointer to integer conversion sending 'NSArray *__strong' to parameter of type 'NSUInteger'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM