iPhone X top inset values

Hey guys.

I’m just testing (corona native) in the Xcode iPhone X simulator and “display.getSafeAreaInsets()” returns 0,0,0,0

Am I missing something for native?

Thanks,

Xcode iPhone X simulator is also giving me strange values. Corona simulator seems to be correct.

Corona:

PixelHeight = 2436

SafeAreaInsets = 44/0/34/0

Xcode:

PixelHeight = 2001(!?)

SafeAreaInsets = 132/0/102/0

I ended up submitting using a simulator build (not native). I guess there’s something I’ve missed in xcode somewhere.

Maybe I’m just tired, stressed and overworked, but I can’t resolve this issue.

On all phones other than iPhone X (which I don’t have), there is an extra inset on top. I stupidly released an iPhone X version and now players are telling me that buttons on top of the screen are too low :frowning:

Also, using Corona Native, the xcode simulator returns 0,0,0,0 for the safe areas.

Any ideas?

Rob let me bring this up with the engineers. I know there are some circumstances where the values are inconsistent. But I’m not sure why native builds are returning 0 for everything. 

Rob

Unfortunately Simulator behavior is different than real device one. We plan to fix it really soon.

About safe area insets: they also account for system UIs like status bar.

Are your issues on Android or iOS?

Thanks Rob. I’m a bit lost with this.

Then the first question of this thread remains. why top-inset in iphone6,7,8 is not zero in a game with a hidden status bar.

simulator returns zero, which seems to be the “right answer” but not real iPhone 6

roballison182,  your best bet is to specifically check for iPhone_x ( using system info) and only then lower buttons on top.

I hoped we can do this by lowering all platforms by “top-inset” and it would be generic clean code, but won’t work as just discovered.

Hey guys!

Latest daily build, 3173 should contain better values for safe area insets. They should behave way more similar to iOS devices (i.e. include safe area when status bar is shown)

Here’s app I use for testing: gist, zip

Also, I did not find any issues with native use of safe areas. I would be grateful if someone to provide me with how to reproduce their issues.

What version of Corona are you using?

Rob

2017.3155

Hi MartingK, Did you find a solution to this issue?

I’m checking with Engineering. Our skins are approximations in particular with things like status bars. But I would think the numbers should be the same or closer.

Rob

Something is fishy, maybe ambiguous documentation or a misunderstanding from me or an xCode simulator bug, or a Corona bug.

topInset in Corona simulator understandably returns ZERO on iPhone 6

while on xCode simulator iPhone 6 it returns a 42

Safe area insets are not 0s for everything except iPhone X. Safe insets would include such features as:

  • curved screen like on iPhone X

  • software buttons

  • status bars

  • Android TV/tvOS - overscan area

  • navigation bar on Android

Corona Simulator safeInsets are  inconsistent with what would be reported on real devices. We’re working on fixing those issues.

Thanks for the info.

And just to clarify why I expect TopInset to be zero, it is because I have UIStatusBarHidden=true, and all other conditions you mentioned don’t hold.

Solving the inconsistency will make us understand better

Hi Vlad and Everyone;

I’m going to throw in a side question here related to the iPhone X because you contributors/readers are those presently dealing with the changes demanded by this phone. It seems better than starting a new forum thread. My question is:

If you were going to write a small block of code as a test for “Am I running on an iPhone X?”, what would that block be composed of?  Primarily dimensional checks? Additional system.getInfo checks? Any thoughts?

Thanks;

Steve

On real device it would be something like

system.getInfo("architectureInfo") == "iPhone10,6"

Also, I would recommend just using safe insets for layout.

Thanks Vlad.

That was a part of what I was thinking of using as a check. Of course I won’t trust it until someone has a device in-hand and confirms this return string. :slight_smile:

As a secondary check, I was thinking of testing whether

(display.actualContentHeight ~= display.safeActualContentHeight) or (display.actualContentWidth ~= display.safeActualContentWidth)

as one or the other of these will always be true on an iPhone X depending on orientation.

Steve