britannio / in_app_review

A Flutter plugin for showing the In-App Review/System Rating pop up on Android, IOS, and MacOS. It makes it easy for users to rate your app.
295 stars 76 forks source link

Review dialog doesn't always display after calling requestReview() on iOS in development mode #118

Open mvn-hangtran-dn opened 3 months ago

mvn-hangtran-dn commented 3 months ago

Follow this official document, review dialog is always displayed. But I tested found that sometimes it doesn't display without error. Seem like foregroundActive state of scene can not be founded. iOS version: 16.3

flutter doctor -v

[✓] Flutter (Channel stable, 3.0.0, on macOS 14.3.1 23D60 darwin-arm, locale en-US)
    • Flutter version 3.0.0 at /Users/hang.tran/fvm/3.0.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ee4e09cce0 (1 year, 10 months ago), 2022-05-09 16:45:18 -0700
    • Engine revision d1b9a6938a
    • Dart version 2.17.0
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/hang.tran/Library/Android/sdk
    • Platform android-34, build-tools 31.0.0
    • ANDROID_HOME = /Users/hang.tran/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode15.2.app/Contents/Developer
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (3 available)
    • iPhone 15 Pro (mobile) • E886117B-B7BA-4E03-83EF-758AC2D121F8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 14.3.1 23D60 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 123.0.6312.58

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
britannio commented 3 months ago

Do you have any way to reproduce the error?

mvn-hangtran-dn commented 3 months ago

@britannio You can call requestReview(in:) when the scene hasn't attached. So the active scene is nil and review dialog can not show. By the way, why do you need to use an active scene? I tried to use an unattached scene and the review dialog can show with it. I'm not sure about mechanism of scene.

mvn-hangtran-dn commented 3 months ago

What do you think about this suggestion?

britannio commented 3 months ago

https://github.com/britannio/in_app_review/commit/1faabe24a94760d4dedc4268e6cb995185ccfdf1

Presumably this change is sufficient?