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

Potential resize issue in 1.9.0 on iOS related to subviews. #3789

Closed
WillCalderwood opened this issue Jan 28, 2016 · 4 comments
Closed

Potential resize issue in 1.9.0 on iOS related to subviews. #3789

WillCalderwood opened this issue Jan 28, 2016 · 4 comments
Labels

Comments

@WillCalderwood
Copy link
Contributor

This may be by design and I've not looked into it too thoroughly as I've worked around the problem but thought I should draw attention to it.

I'm using AdMob banners, and when the screen was resized I destroyed the old AdView and created a new one to handle orientation change. When I upgraded to 1.9.0 the iOS version went into a resize loop when I started the game, where resize was being called on every game loop.

The iOS version now calls resize when a subview is added, this lead my code to destroy and recreate my adview, which then caused resize to be called again on the next loop.

The thing that makes this look like it might be a bug is that if I returned to the home screen of the iPad and back to the game, this stopped happening.

@WillCalderwood WillCalderwood changed the title Potential resize issue in 1.9.0 in iOS related to subviews. Potential resize issue in 1.9.0 on iOS related to subviews. Jan 28, 2016
@davebaol davebaol added the ios label Jan 28, 2016
@Darkyenus
Copy link
Contributor

I believe this may be caused by this (mine) PR which moved resize to be called on subview layout. If I understand the problem correctly, it should be possible to fix it by caching last values with which resize() was called and calling it again only if they change. (resize() is called with the same width/height each time, is that assumption correct?)

I'll look into it after #3709. Can you please provide SSCCE of application with banner ad view for testing and verifying the fix?

@ITSimples
Copy link

Happen the same to me, in version 1.8.0 is everything working fine, now with 1.9.0 on resize IOS the game crash, I disabled admob and still happening.
Here is the error:

2016-02-08 16:35:02.733 IOSLauncher[219:11331] [debug] IOSApplication: iOS version: 9.2.1 2016-02-08 16:35:02.735 IOSLauncher[219:11331] [debug] IOSApplication: Running in 32-bit mode 2016-02-08 16:35:02.739 IOSLauncher[219:11331] [debug] IOSApplication: scale: 2.0 2016-02-08 16:35:02.749 IOSLauncher[219:11331] [debug] IOSApplication: Status bar is not visible 2016-02-08 16:35:02.749 IOSLauncher[219:11331] [debug] IOSApplication: Total computed bounds are w=2048.0 h=1536.0 2016-02-08 16:35:02.794 IOSLauncher[219:11331] [debug] IOSGraphics: Display: ppi=264, density=1.65 2016-02-08 16:35:02.937 IOSLauncher[219:11331] [debug] IOSApplication: created 2016-02-08 16:35:02.938 IOSLauncher[219:11331] [info] gdx-pay: initializeIAP(): purchaseManager == null => call PurchaseSystem.hasManager() 2016-02-08 16:35:02.939 IOSLauncher[219:11331] [info] IAP: IAP: gdx-pay successfully instantiated. 2016-02-08 16:35:02.939 IOSLauncher[219:11331] [info] gdx-pay: calls PurchaseSystem.install() via reflection [GdxPay/AppleIOS] Installing purchase observer... [GdxPay/AppleIOS] Requesting products... 2016-02-08 16:35:02.962 IOSLauncher[219:11331] [info] gdx-pay: installed manager: AppleIOS 2016-02-08 16:35:02.978 IOSLauncher[219:11331] [debug] IOSApplication: resumed 2016-02-08 16:35:02.982 IOSLauncher[219:11331] [debug] IOSApplication: Status bar is not visible 2016-02-08 16:35:02.982 IOSLauncher[219:11331] [debug] IOSApplication: Total computed bounds are w=2048.0 h=1536.0 2016-02-08 16:35:02.983 IOSLauncher[219:11331] [info] BaseGame: Resizing Stage ... java.lang.NullPointerException at com.itsimples.appbook.scene2d.ITSActors.ITSStage.updateViewport(ITSStage.java:70) at com.itsimples.appbook.BaseGame.resize(BaseGame.java:72) at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$IOSUIViewController.viewDidLayoutSubviews(IOSGraphics.java:115) at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$IOSUIViewController.$cb$viewDidLayoutSubviews(IOSGraphics.java) at org.robovm.apple.uikit.UIApplication.main(Native Method) at org.robovm.apple.uikit.UIApplication.main(UIApplication.java:413) at com.itsimples.appbook.IOSLauncher.main(IOSLauncher.java:51)

Thx

@Darkyenus
Copy link
Contributor

That stack trace points to your code and without seeing it I can't tell what is broken and what it is related to. I suggest taking this to IRC or forums until it is certain that this is an issue with libGDX.

Btw. Use triple-backticks for block-formatted code (code)

@ITSimples
Copy link

Thx for the tips Darkyenus. I will do that.

Darkyenus added a commit to Darkyenus/libgdx that referenced this issue Mar 11, 2016
This is a breaking change, but makes the API consistent with core.
Fixes libgdx#3789 (resize() being triggered with same dimensions)
Fixes touch mapping on older iOS versions when screen is rotated
MrStahlfelge added a commit that referenced this issue Oct 13, 2020
* Change how retina resolutions are handled

This is a breaking change, but makes the API consistent with core.
Fixes #3789 (resize() being triggered with same dimensions)
Fixes touch mapping on older iOS versions when screen is rotated

* Update CHANGES

Co-authored-by: obigu <torinthechosen@gmail.com>
Co-authored-by: Benjamin Schulte <MrStahlfelge@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants