我正在处理此登录视图。我希望用户在没有输入他/她的凭据时收到通知。例如,如果未输入用户名,则需要显示“请输入您的用户名”和密码。 还有用户名和密码。到目前为止我的代码:
- (IBAction)testButton:(id)sender {
if (![self.usernameBox.text isEqualToString:@""] && ![self.passwordBox.text isEqualToString:@""])
{
[self showLoginProcess:true];
[[AuthSingleton getInstance] setDelegate:self];
[[AuthSingleton getInstance] attemptLoginWithUsername:self.usernameBox.text andPassword:self.passwordBox.text];
} else
{
NSLog(@"username or password is empty %@", kBaseURL);
}
由于
答案 0 :(得分:1)
根据我的理解,你正在寻找一些逻辑来显示适当条件的正确信息。试试这可能会有所帮助。
if ([self.usernameBox.text length] > 0 && [self.usernameBox.text length] > 0)
{
[self showLoginProcess:true];
[[AuthSingleton getInstance] setDelegate:self];
[[AuthSingleton getInstance] attemptLoginWithUsername:self.usernameBox.text andPassword:self.passwordBox.text];
} else
{
NSString *message;
if ([self.usernameBox.text length] <= 0 && [self.passwordBox.text length] <=0)
message = @"Enter both the Fields";
else if ([self.usernameBox.text length] <= 0 )
message = @"Enter username";
else if ([self.passwordBox.text length] <=0 )
message = @"Enter password";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
答案 1 :(得分:0)
嘿,你可以通过单一条件来做到这一点,
SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
Backtrace:
1 C:\wamp\www\var\simplesamlphp\www\_include.php:37 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: Exception: Unexpected root node: [urn:oasis:names:tc:SAML:2.0:protocol]:Response
Backtrace:
2 C:\wamp\www\var\simplesamlphp\lib\SimpleSAML\Metadata\SAMLParser.php:305 (SimpleSAML_Metadata_SAMLParser::parseDescriptorsElement)
1 C:\wamp\www\var\simplesamlphp\lib\SimpleSAML\Metadata\SAMLParser.php:281 (SimpleSAML_Metadata_SAMLParser::parseDescriptorsString)
0 C:\wamp\www\var\simplesamlphp\www\admin\metadata-converter.php:11 (N/A)