Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS touch inputs not working after calling SKStoreReviewController.requestReview(); #621

Closed
CoderBaron opened this issue Jan 30, 2022 · 8 comments

Comments

@CoderBaron
Copy link
Contributor

Issue details

When you call SKStoreReviewController.requestReview() or requestReviewInScene() and close the opening rating controller, the app will not respond to touch/key inputs anymore. It doesn't matter from which thread you call that function.
However rendering continues to work normally.

Reproduction steps/code

Create a default RoboVM iOS app within IDEA and add that code snippet to ViewController.java:

    @Override
    public void viewDidAppear(boolean animated) {
        super.viewDidAppear(animated);

        SKStoreReviewController.requestReview();
    }

Run the app on simulator, dismiss the opening view controller and then try to tap the button. It will not work.

The issue doesn't happen with a Xcode iOS project without RoboVM.

Configuration

Build Tools:

  • IDEA plugin

Versions:

  • Robovm: 2.3.15-SNAPSHOT
  • XCode: 13.2.1
  • JDK: 11

Build Targets:

only iOS > 15
Simulator and Device


I'm not sure if this may be related to iOS 15 "app prewarming":
https://developer.apple.com/documentation/uikit/app_and_environment/responding_to_the_launch_of_your_app/about_the_app_launch_sequence?language=objc#3894431

@dkimitsa
Copy link
Contributor

hi, while I still debugging the issue, there are few findings:

  • window doesn't become key and as result is not receiving any inputs;
  • workaround (not sure if there will be no other side effects) is to make window key on resign by using UIWIndow subclass:
    static class MyWindow extends UIWindow {
        public MyWindow(CGRect frame) {
            super(frame);
        }

        @Override
        public void resignKeyWindow() {
            super.resignKeyWindow();
            makeKeyAndVisible();
        }
}        

@dkimitsa
Copy link
Contributor

also SKStoreReviewPresentationWindow stays as key window after dismissing the dialog.

@dkimitsa
Copy link
Contributor

fixed in #622

@dkimitsa
Copy link
Contributor

few notes. It turned into interesting investigation:

  • first it turned out that application window is not getting back as keyWindow;
  • then it turned that similar code Xcode app is working fine
  • then it turned that after dismissing dialog SKStoreReviewPresentationWindow stays as keyWindow;
  • then it dismissed that SKStoreReviewPresentationWindow triggers keyWindow re-election it own dealloc;
  • and dealloc was never called in case of RoboVM;
  • as instance of keyWindow is was kept by RoboVM in UIApplication.KEY_WINDOW;

The fix -- remove logic to keep keyWindow by RoboVM internals. Every project is responsible to do it (somewhere in ApplicationDelegate).

And have business logic in destructor is bad case, even for apple.

@guillerodriguez
Copy link

Every project is responsible to do it (somewhere in ApplicationDelegate).

and

This change might break some project that doesn't strong keep windows somewhere in AppDelegate

Can you share some sample code of what exactly should be done in AppDelegate ?

@dkimitsa
Copy link
Contributor

@guillerodriguez
keep window instance in member of Application Delegate. Usually its done like this. iOS ObjC projects were keeping it in retained property.

public class Main extends UIApplicationDelegateAdapter {
    private UIWindow window;

    @Override
    public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
        window = new UIWindow(UIScreen.getMainScreen().getBounds());
        //// ....
    }

@guillerodriguez
Copy link

This must be done always? Or only if using SKStoreReviewController.requestReview() ?

If the former, then the PR #622 should include a BIG red warning since this can potentially break any project.

@dkimitsa
Copy link
Contributor

@guillerodriguez its related to projects that ViewControllers and creates Window manually (so now they are responsible to track manually) . But today projects without storyboards/scene are not supported so most likely it affect to production wise projects

Tom-Ski added a commit that referenced this issue Jan 31, 2022
* fixed #621: iOS touch inputs not working after calling SKStoreReviewController.requestReview();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants