Problem solved. I deleted bin and obj folders, closed VS for Mac and rebuilt the app again.
Thank you
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am trying the below code but it keeps throwing error when I use it on my app. Although I am not getting any error when using the URL in Postman and everything is fine there
Here is the code:
var client = new HttpClient();
client.BaseAddress = new Uri("https://www.jassimrahma.net/temp/signin.php");
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("email", TextBoxSigninEmailAddress.Text.Trim()),
new KeyValuePair<string, string>("password", TextBoxSigninPassword.Text.Trim())
});
var response = await client.PostAsync("https://www.jassimrahma.net/temp/signin.php", content);
var result = await response.Content.ReadAsStringAsync();
List<SigninData> data = JsonSerializer.Deserialize<List<SigninData>>(result);
if (data.Count <= 0)
{
await App.Current.MainPage.DisplayAlert("Error", "Unable to find your account!", "Try Again");
TextBoxSigninPassword.Text = "";
BusyIndicatorSignin.IsBusy = false;
ButtonForgotPassword.IsVisible = true;
ButtonSigninNow.IsVisible = true;
return;
}
else
{
await SecureStorage.SetAsync("UserID", data[0].user_id);
popupLayout.IsOpen = false;
}
Here is the error I am getting:
System.NullReferenceException: Object reference not set to an instance of an object
at Zeera.Signin.ButtonSigninNow_Clicked (System.Object sender, System.EventArgs e) [0x00416] in /Users/jassim/Projects/Zeera/Zeera/Signin.xaml.cs:205
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178
at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65
at Zeera.iOS.Application.Main (System.String[] args) [0x00001] in /Users/jassim/Projects/Zeera/Zeera.iOS/Main.cs:17
you can try with the following:
Email: jrahma@réalisations .com
Password : Bahrain1234
Kindly help..
Thanks,
Jassim
Problem solved. I deleted bin and obj folders, closed VS for Mac and rebuilt the app again.
Thank you