Pearl (asyncmeow)
Pearl (asyncmeow)
CC#
Created by Pearl (asyncmeow) on 4/17/2024 in #help
IEnumerable<T> (or List<T>, or T[]) to IEnumerable (non-generic, ie. no type param)?
Hello, I'm working on some code that takes an object that may be either an object T itself, or some form of an IEnumerable<T>. The thing is, I don't actually know T in this context (as it's a asp.net IActionFilter). How would I check if that object is an IEnumerable and if it is, get the object as that IEnumerable to iterate over it?
2 replies
CC#
Created by Pearl (asyncmeow) on 9/20/2023 in #help
❔ Error in iOS MAUI app when trying to use WebAuthenticator
Hello! I'm trying to write a simple mobile app that hits my own API. I wrote a wrapper for the API that triggers a new authentication with WebAuthenticator.AuthenticateAsync if there's no valid authentication session. This works if I trigger a new auth session from a button, but trying to do an API request when a view loads (from OnAppearing) gives me this on iOS:
Foundation.NSErrorException: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=3 "The UIWindowScene for the returned window was not in the foreground active state." UserInfo={NSDebugDescription=The UIWindowScene for the returned window was not in the foreground active state.}
at Microsoft.Maui.Authentication.WebAuthenticatorImplementation.AuthenticateAsync(WebAuthenticatorOptions webAuthenticatorOptions)
at [...].Mobile.Services.AuthService.ForceAuthenticate() in [...]/Services/AuthService.cs:line 67
Foundation.NSErrorException: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=3 "The UIWindowScene for the returned window was not in the foreground active state." UserInfo={NSDebugDescription=The UIWindowScene for the returned window was not in the foreground active state.}
at Microsoft.Maui.Authentication.WebAuthenticatorImplementation.AuthenticateAsync(WebAuthenticatorOptions webAuthenticatorOptions)
at [...].Mobile.Services.AuthService.ForceAuthenticate() in [...]/Services/AuthService.cs:line 67
Is there a specific place I should be doing this in on view initialization in order to immediately pop up the login prompt (if needed) when a view is opened? (fwiw - if this is something that would normally get an app removed from the app store, it's not really an issue I care about - this is an app only for my personal use, and has other stuff that would probably get it removed anyway like using SSO but not having appleid support for SSO 😅 )
2 replies