Я разрабатываю приложение для iOS Maui, и я получил полностью функциональное приложение, которое работает без проблем. Проблема, которая у меня есть, заключается в том, что в Android нет кнопки «обратно», которая позволяет пользователю вернуться на предыдущую страницу, и не существует навигации , как то, что генерируется по умолчанию в Xamarin.
Как я понимаю, способность отключения отключена, если не использует навигационную мону Navigationbar или navigationpage Итак, у пользователя есть эта стрелка или кнопку обратной стрелки, чтобы вернуться на предыдущий экран. Я использовал пример здесь, чтобы добавить код, который мне нужен для появления панели. Но как только я добавляю этот код в свой App.xaml.cs Files < /p>
MainPage = new NavigationPage(new Logon());
< /code>
Приложение немедленно сбои, когда я запускаю его на своем тестовом устройстве. Приложение разбивается в строке 'uiapplication.main (args, null, typeof (appdelegate));
' в файле кода Program.cs в папке iOS с системой ошибок. NullReanceExexcept экземпляр объекта. . Этот код: < /p>
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
< /code>
Я сообщил о проблеме Microsoft здесь для тех, кто хочет посмотреть все мои исследования до сих пор. Было несколько проблем, с которыми я сталкивался, когда пробовал разные вещи, все это было прояснилось после обновления моего Mac и тестирования iPhone до последней ОС. < /P>
****** **** РЕДАКТИРОВАТЬ *********************
Это вход в систему код: < Br />public partial class Logon : ContentPage
{
public Logon()
{
InitializeComponent();
}
User MyUser = new User();
CompanyInformation MyCompany = new CompanyInformation();
bool error = false;
private async void OnCounterClicked(object sender, EventArgs e)
{
string username = TheUsername.Text;
string password = ThePassword.Text;
if (username != null)
{
if (password != null)
{
activityIndicator.IsVisible = true;
#if ANDROID
await Task.Run(() => SignOn());
#elif IOS
iOSSignon();
#endif
}
else
{
await DisplayAlert("ERROR", "Enter your password.", "OK");
}
}
else
{
await DisplayAlert("ERROR", "Enter your username.", "OK");
}
}
public void iOSSignon()
{
string result = "";
MyUser.Username = TheUsername.Text.Trim();
MyUser.Password = ThePassword.Text.Trim();
try
{
bool isOnline = Utils.IsConnectedToTheInternet();
if (isOnline)
{
MyServiceSoapClient myService = new MyServiceSoapClient(MyServiceSoapClient.EndpointConfiguration.MyServiceSoap);
try
{
result = myService.Logon(MyUser.Username, MyUser.Password);
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn - An error occured in SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "There was an error in the logon process. The error was reported to technical support, please try again later of contact technical support at Support@MyCompany.com.", "OK");
}
}
else
{
DisplayAlert("Information", "There is no internet connection or cell phone connection. Connect to a wifi network or a cellular network.", "OK");
}
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs - An error occured in the SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "An error occured in the logon process. The error was reported to technical support, please try again later or contact technical support at Support@MyCompany.com.", "OK");
}
if (result == "CONNECTED")
{
Menu MyMenu = new Menu();
MyMenu.MyUser = MyUser;
Navigation.PushModalAsync(MyMenu);
}
else if (result == "DISABLED")
{
DisplayAlert("Information", "Your account has been disabled, contact your supervisor for more information.", "OK");
}
else
{
try
{
error = true;
DisplayAlert("Information", "Invalid username or password.", "OK");
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "An error occurred during the logon process. The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
;
try
{
if (error)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() (2) - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: ");
}
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() (2) - An error occured in Logon.xaml.cs Signin function (second block), the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "An error occurred during the logon process (2). The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
private async Task SignOn()
{
string result = "";
MyUser.Username = TheUsername.Text.Trim();
MyUser.Password = ThePassword.Text.Trim();
try
{
bool isOnline = Utils.IsConnectedToTheInternet();
if (isOnline)
{
MyServiceSoapClient myService = new MyServiceSoapClient(MyServiceSoapClient.EndpointConfiguration.MyServiceSoap);
try
{
result = myService.Logon(MyUser.Username, MyUser.Password);
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn - An error occured in SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "There was an error in the logon process. The error was reported to technical support, please try again later of contact technical support at Support@MyCompany.com.", "OK");
}
}
else
{
await DisplayAlert("Information", "There is no internet connection or cell phone connection. Connect to a wifi network or cellular network.", "OK");
}
;
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs - An error occured in the SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "An error occured in the logon process. The error was reported to technical support, please try again later or contact technical support at Support@MyCompany.com.", "OK");
}
;
if (result == "CONNECTED")
{
Menu MyMenu = new Menu();
MyMenu.MyUser = MyUser;
await Navigation.PushModalAsync(MyMenu);
}
else if (result == "DISABLED")
{
await DisplayAlert("Information", "Your account has been disabled, contact your subervisor for more information.", "OK");
}
else
{
try
{
error = true;
await DisplayAlert("Information", "Invalid username or password.", "OK");
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "An error occurred during the logon process. The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
;
try
{
if (error)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() (2) - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: ");
}
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logone.xaml.cs/SignOn() (2) - An error occured in Logon.xaml.cs Signin function (second block), the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "An error occurred during the logon process (2). The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... mmediately
Использование NavigationPage в Maui приводит к немедленному сбою приложения ⇐ IOS
Программируем под IOS
1740072014
Anonymous
Я разрабатываю приложение для iOS Maui, и я получил полностью функциональное приложение, которое работает без проблем. Проблема, которая у меня есть, заключается в том, что в Android нет кнопки «обратно», которая позволяет пользователю вернуться на предыдущую страницу, и не существует навигации , как то, что генерируется по умолчанию в Xamarin.
Как я понимаю, способность отключения отключена, если не использует навигационную мону Navigationbar или navigationpage Итак, у пользователя есть эта стрелка или кнопку обратной стрелки, чтобы вернуться на предыдущий экран. Я использовал пример здесь, чтобы добавить код, который мне нужен для появления панели. Но как только я добавляю этот код в свой App.xaml.cs Files < /p>
MainPage = new NavigationPage(new Logon());
< /code>
Приложение немедленно сбои, когда я запускаю его на своем тестовом устройстве. Приложение разбивается в строке 'uiapplication.main (args, null, typeof (appdelegate));
' в файле кода Program.cs в папке iOS с системой ошибок. NullReanceExexcept экземпляр объекта. . Этот код: < /p>
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
< /code>
Я сообщил о проблеме Microsoft здесь для тех, кто хочет посмотреть все мои исследования до сих пор. Было несколько проблем, с которыми я сталкивался, когда пробовал разные вещи, все это было прояснилось после обновления моего Mac и тестирования iPhone до последней ОС. < /P>
****** **** РЕДАКТИРОВАТЬ *********************
Это вход в систему код: < Br />public partial class Logon : ContentPage
{
public Logon()
{
InitializeComponent();
}
User MyUser = new User();
CompanyInformation MyCompany = new CompanyInformation();
bool error = false;
private async void OnCounterClicked(object sender, EventArgs e)
{
string username = TheUsername.Text;
string password = ThePassword.Text;
if (username != null)
{
if (password != null)
{
activityIndicator.IsVisible = true;
#if ANDROID
await Task.Run(() => SignOn());
#elif IOS
iOSSignon();
#endif
}
else
{
await DisplayAlert("ERROR", "Enter your password.", "OK");
}
}
else
{
await DisplayAlert("ERROR", "Enter your username.", "OK");
}
}
public void iOSSignon()
{
string result = "";
MyUser.Username = TheUsername.Text.Trim();
MyUser.Password = ThePassword.Text.Trim();
try
{
bool isOnline = Utils.IsConnectedToTheInternet();
if (isOnline)
{
MyServiceSoapClient myService = new MyServiceSoapClient(MyServiceSoapClient.EndpointConfiguration.MyServiceSoap);
try
{
result = myService.Logon(MyUser.Username, MyUser.Password);
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn - An error occured in SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "There was an error in the logon process. The error was reported to technical support, please try again later of contact technical support at Support@MyCompany.com.", "OK");
}
}
else
{
DisplayAlert("Information", "There is no internet connection or cell phone connection. Connect to a wifi network or a cellular network.", "OK");
}
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs - An error occured in the SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "An error occured in the logon process. The error was reported to technical support, please try again later or contact technical support at Support@MyCompany.com.", "OK");
}
if (result == "CONNECTED")
{
Menu MyMenu = new Menu();
MyMenu.MyUser = MyUser;
Navigation.PushModalAsync(MyMenu);
}
else if (result == "DISABLED")
{
DisplayAlert("Information", "Your account has been disabled, contact your supervisor for more information.", "OK");
}
else
{
try
{
error = true;
DisplayAlert("Information", "Invalid username or password.", "OK");
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "An error occurred during the logon process. The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
;
try
{
if (error)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() (2) - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: ");
}
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() (2) - An error occured in Logon.xaml.cs Signin function (second block), the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
DisplayAlert("ERROR", "An error occurred during the logon process (2). The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
private async Task SignOn()
{
string result = "";
MyUser.Username = TheUsername.Text.Trim();
MyUser.Password = ThePassword.Text.Trim();
try
{
bool isOnline = Utils.IsConnectedToTheInternet();
if (isOnline)
{
MyServiceSoapClient myService = new MyServiceSoapClient(MyServiceSoapClient.EndpointConfiguration.MyServiceSoap);
try
{
result = myService.Logon(MyUser.Username, MyUser.Password);
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn - An error occured in SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "There was an error in the logon process. The error was reported to technical support, please try again later of contact technical support at Support@MyCompany.com.", "OK");
}
}
else
{
await DisplayAlert("Information", "There is no internet connection or cell phone connection. Connect to a wifi network or cellular network.", "OK");
}
;
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs - An error occured in the SignOn function, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "An error occured in the logon process. The error was reported to technical support, please try again later or contact technical support at Support@MyCompany.com.", "OK");
}
;
if (result == "CONNECTED")
{
Menu MyMenu = new Menu();
MyMenu.MyUser = MyUser;
await Navigation.PushModalAsync(MyMenu);
}
else if (result == "DISABLED")
{
await DisplayAlert("Information", "Your account has been disabled, contact your subervisor for more information.", "OK");
}
else
{
try
{
error = true;
await DisplayAlert("Information", "Invalid username or password.", "OK");
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "An error occurred during the logon process. The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
;
try
{
if (error)
{
Utils.LogError("App:MyApp/Logon.xaml.cs/SignOn() (2) - An error occured in the Logon.xaml.cs SignOn function result = connected, the error is: ");
}
}
catch (Exception ex)
{
Utils.LogError("App:MyApp/Logone.xaml.cs/SignOn() (2) - An error occured in Logon.xaml.cs Signin function (second block), the error is: " + ex.Message + System.Environment.NewLine + Utils.GetExceptionInfo(ex));
await DisplayAlert("ERROR", "An error occurred during the logon process (2). The error has been reported to technical support, please try again or contact technical support at Support@MyCompany.com", "OK");
}
}
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79453129/using-navigationpage-in-maui-causes-app-to-crash-immediately[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия