I created app for both Android and iOS. I need to add dialog to login. I used the simple one like InputQuery with 2 fields. Unfortunately InputQuery does not work on iPhone or simulator. It's just shuts off app silently without error. The code snippet is below:
===================================
procedure callUserLogin(sUsername, sPassword: String);
var
Prompts: TArray<string>;
Defaults: TArray<string>;
begin
Prompts := ['Username:', 'Password:'];
Defaults := [sUsername, sPassword];
TDialogServiceAsync.InputQuery('Login', Prompts, Defaults,
procedure(const AResult: TModalResult; const AValues: array of string)
begin
if (AResult = mrOk) then
begin
// Process AValues[0] (Username) and AValues[1] (Password)
sUsername := Trim(AValues[0]);
if ((LowerCase(sUsername) = 'genesis') and (AValues[1] = '71962')) then
begin
LastLoginName := sUserName;
Application.Run;
end
else
begin
ShowMessage('Invalid credentials. Please try again.');
callUserLogin(sUsername, sPassword); // call itself
end;
end
else
Application.Terminate;
end);
end;
===================================
How to fix it? Or what other way to create dialog? I tried to use custom dialog and it does not work with ShowModal even with anonymous method). Create native iOS dialog?
Вопрос
fredff13
I created app for both Android and iOS. I need to add dialog to login. I used the simple one like InputQuery with 2 fields. Unfortunately InputQuery does not work on iPhone or simulator. It's just shuts off app silently without error. The code snippet is below:
===================================
procedure callUserLogin(sUsername, sPassword: String);
var
Prompts: TArray<string>;
Defaults: TArray<string>;
begin
Prompts := ['Username:', 'Password:'];
Defaults := [sUsername, sPassword];
TDialogServiceAsync.InputQuery('Login', Prompts, Defaults,
procedure(const AResult: TModalResult; const AValues: array of string)
begin
if (AResult = mrOk) then
begin
// Process AValues[0] (Username) and AValues[1] (Password)
sUsername := Trim(AValues[0]);
if ((LowerCase(sUsername) = 'genesis') and (AValues[1] = '71962')) then
begin
LastLoginName := sUserName;
Application.Run;
end
else
begin
ShowMessage('Invalid credentials. Please try again.');
callUserLogin(sUsername, sPassword); // call itself
end;
end
else
Application.Terminate;
end);
end;
===================================
How to fix it? Or what other way to create dialog? I tried to use custom dialog and it does not work with ShowModal even with anonymous method). Create native iOS dialog?
PS I can read/write in Russian
0 ответов на этот вопрос
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.