Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

269
Vistas
requestReview() deprecated in iOS 14, Alternative for xamarin.forms?

I'm using

SKStoreReviewController.RequestReview ();

in a dependency service for Xamarin.Forms. However this is now deprecated from iOS 14. And I want to know how to integrate with the new UIWindowScene

requestReview(in windowScene: UIWindowScene)

in Xamarin.Forms

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

First, you can try to add SKStoreReviewController.RequestReview(Window.WindowScene) in the FinishedLaunching method of your xxx.ios->AppDelegate.cs; start the project to see if it is correct.

If the above method goes wrong, using DependencyService is the right way to go.

Here is the interface code:

 public interface MyInterface
{
     void RequestReview();
}

Here is the implementation method of the interface in ios:

[assembly: Dependency(typeof(MyInterfaceImpl))]
namespace App19.iOS
{
    public class MyInterfaceImpl : MyInterface
    {
        public void RequestReview()
        {
           var myv = UIDevice.CurrentDevice.CheckSystemVersion(14, 0);
            if (myv)
            {
                UIWindow window = UIApplication.SharedApplication.Delegate.GetWindow();
            SKStoreReviewController.RequestReview(window.WindowScene);
            }
            else 
            {
                SKStoreReviewController.RequestReview();
            }
        }
    }
}

You can call it in the OnStart method inside APP.xaml.cs:

 protected override void OnStart()
    {
        if (Device.RuntimePlatform == Device.iOS)
        {
            DependencyService.Get<IReviewService>().RequestReview();
        }
    }
over 4 years ago · Santiago Trujillo Denunciar

0

I might have a solution:

using StoreKit;
using UIKit;

public void RequestReview(){
    var scene = UIApplication.SharedApplication.KeyWindow.WindowScene;

    if (scene is null)
    {
        //handle the scene being null here
        return;
    }

    SKStoreReviewController.RequestReview(scene);
}

I've found multiple ways of getting the current scene and they both worked when I tested them:

var scene = UIApplication.SharedApplication.KeyWindow.WindowScene;

var alsoScene = UIApplication.SharedApplication.Delegate.GetWindow()?.WindowScene;

You can read more about the difference between the two in this issue

The complete solution where you check the iOS version in order to call the right thing might look like this

using StoreKit;
using UIKit;

public void RequestReview()
{
    var isIos14OrAbove = UIDevice.CurrentDevice.CheckSystemVersion(14, 0);
    if (isIos14OrAbove)
    {
        var scene = UIApplication.SharedApplication.KeyWindow.WindowScene;

        if (scene is null)
        {
            //handle the scene being null here
            return;
        }

        SKStoreReviewController.RequestReview(scene);
    }
    else
    {
        SKStoreReviewController.RequestReview();
    }
}

Hope this helps.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda