iOS touch inputs not working after calling SKStoreReviewController.requestReview();
See original GitHub issueIssue 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:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
there is 2.3.16-SNAPSHOT build of MobiVM where it is fixed
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