question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Issue details

When you call SKStoreReviewController.requestReview() or requestReviewInScene() and close the opening view controller, the app will not respond to touch inputs anymore. It doesn’t matter if you call the function from the libGDX or iOS main thread. However rendering continues to work normally.

Reproduction steps/code

Create a new game with the libGDX setup jar. Modify the following generated classes.

MyGdxGame.java:

package com.mygdx.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;

public class MyGdxGame extends ApplicationAdapter implements InputProcessor {
	SpriteBatch batch;
	Texture img;
	int lastScreenX, lastScreenY;
	
	@Override
	public void create () {
		batch = new SpriteBatch();
		img = new Texture("badlogic.jpg");
		Gdx.input.setInputProcessor(this);
	}

       @Override
	public void resume() {
		super.resume();
		lastScreenX = Gdx.graphics.getWidth() / 2;
		lastScreenY = Gdx.graphics.getHeight() / 2;
	}

	@Override
	public void render() {
		ScreenUtils.clear(Color.BLACK);
		batch.begin();
		batch.draw(img, lastScreenX, lastScreenY);
		batch.end();
	}

	@Override
	public boolean keyDown(int keycode) {
		return false;
	}

	@Override
	public boolean keyUp(int keycode) {
		return false;
	}

	@Override
	public boolean keyTyped(char character) {
		return false;
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		lastScreenX = screenX;
		lastScreenY = Gdx.graphics.getHeight() - screenY;
		return false;
	}

	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		return false;
	}

	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {
		return false;
	}

	@Override
	public boolean mouseMoved(int screenX, int screenY) {
		return false;
	}

	@Override
	public boolean scrolled(float amountX, float amountY) {
		return false;
	}
}

IOSLauncher.java:

package com.mygdx.game;

import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import org.robovm.apple.foundation.NSAutoreleasePool;
import org.robovm.apple.storekit.SKStoreReviewController;
import org.robovm.apple.uikit.UIApplication;

public class IOSLauncher extends IOSApplication.Delegate {
    @Override
    protected IOSApplication createApplication() {
        IOSApplicationConfiguration config = new IOSApplicationConfiguration();
        return new IOSApplication(new MyGdxGame(), config);
    }

    public static void main(String[] argv) {
        NSAutoreleasePool pool = new NSAutoreleasePool();
        UIApplication.main(argv, null, IOSLauncher.class);
        pool.close();
    }

    boolean first;

    @Override
    public void didBecomeActive(UIApplication application) {
        super.didBecomeActive(application);

        if (!first) {
            first = true;
        } else {
            SKStoreReviewController.requestReviewInScene(getWindow().getWindowScene());
        }
    }
}

You have to run this test app on an iOS device optimally with iOS 15 (that’s the version I used). Use a wildcard provisioning profile or edit the app.id in the robovm.properties file to one of your registered iOS app ids for quick testing. If you use one of your app ids your app will be deleted from your device when installing this test app.

When you run the app you can tap the screen to move the image around. Minimize the app, then reopen it and the review view controller should open. Dismiss it and voilà - touch input doesn’t work anymore. You can tap around but the image doesn’t move. To find out where this issue originates I would put breakpoints into IOSGraphics.java line 111 and 126 (touchesBegan, touchesMoved). This should normally be called whenever you touch the screen. If this doesn’t get called anymore after dismissing the reviewcontroller, it means that the issue is with the GLKView and how it is setup. If it does get called, then it’s certainly an issue how libGDX handles iOS touch input.

I would test it myself, unfortunately my debug setup for iOS doesn’t work. I can’t get the debugger to work.

Version of libGDX and/or relevant dependencies

1.10.0

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • macOS

For now I’m removing the review feature from my apps because I don’t want my apps to freeze. I hope someone with working iOS debug setup can nail down this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dkimitsacommented, Feb 1, 2022

there is 2.3.16-SNAPSHOT build of MobiVM where it is fixed

1reaction
CoderBaroncommented, Jan 30, 2022

I can now confirm that this is definitely an issue with RoboVM. The issue happens with a simple RoboVM app but doesn’t happen with a simple Xcode app.

https://github.com/MobiVM/robovm/issues/621

Read more comments on GitHub >

github_iconTop Results From Across the Web

SKStoreReviewController not working - Stack Overflow
It is only enabled after the app is downloaded from the app store. During development, or even release build, it is grayed out....
Read more >
SKStoreReviewController requestRe… - Apple Developer
I want to get a review with [SKStoreReviewController requestReview] in my iOS app. It works fine on iOS phones. However, requestReview does not...
Read more >
How to ask users to review your app using ...
You request that the system show a review dialog, which means the request might be ignored based on internal logic known only to...
Read more >
SKStoreReviewController — Apple way to request review and ...
SKStoreReviewController — Apple way to request review and rating inside iOS app in ios 10.3 and higher · import StoreKit. · Check if...
Read more >
[Answer]-App Crashes Only On Testflight Build-swift
I think this has to be a compiler error, or else my "fix" shouldn't be a fix at all. But here it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found