Author Topic: iOS8: Landscape mode got x/y swapped (not fixed in 12.308).  (Read 11471 times)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Today im have tested how the game is running in iOS8 on my iPad 3. Its seen glbasic is require a fix to this issue:
http://stackoverflow.com/questions/24150359/is-uiscreen-mainscreen-bounds-size-becoming-orientation-dependent-in-ios8

Its seen iOS8 now is report the correct orientation, not allways starting in portrait which was in the previous iOS7. That means landscape is screwed up with glbasic, which needs a fix. This is something happens in a code, im dosent have access too.

This is a bug that is required to been fixed, if we countinue want to support iOS and should of course been aware its running in iOS7 and below or iOS8 when this bug is fixed.

In the attachements is what is looking when im starting the game up in landscape mode. Here the windows bounds is totally wrong (its seen started in portrait mode), and the orientation is also started in portrait mode too. Howover when im tilt the device to landscape, the orientation will do correct it, but not the windows bounds.

That might now require fix in the startup code and/or in the SETORIENTATION code. If SETORIENTATION could correct the windows bounds too, then that would been ok. That something like samething happens when "sensor" is used for Android (that shown game is "sensor" based).

PS. apps that uses previous Xcode and iOS7 as target will do countinue work correctly in iOS8 (Karma Miwa and Greedy Mouse do both works absolutte fine).

PPS. This is the only iOS8 issue im have found with glbasic. The fixed xCode project im gave with iOS7 works very nice with the iOS8 build as well. No other fix is required there as im seen.
« Last Edit: 2014-Sep-18 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1621
  • Particle Hawk
    • View Profile
Re: iOS8: Landscape mode got x/y swapped.
« Reply #1 on: 2014-Aug-20 »
I recieved a report about you wanting to remove this thread, is that correct?
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10814
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: iOS8: Landscape mode got x/y swapped.
« Reply #2 on: 2014-Aug-20 »
oops, no! My question is: What do I need to change? (Detail?)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: iOS8: Landscape mode got x/y swapped.
« Reply #3 on: 2014-Aug-20 »
It's was not a thread remove request, just a second post remove request (that is removed).

Im thinks it's best to install xcode6 beta and ios 8 beta to checks your self, then you see it (start the app in landscape mode, not portrait). It's property happens when the surface is created. I'm can do nothing to fix it. The issue only happens on iOS 8, so the fix should only do happens if ios8 is detected as target.

All current xcode 5 projects works fine as iOS7 uses as target (and also orientation correct on iOS8 too with the "old" xcode version).

This is a API change for the windows bounds for iOS8.
« Last Edit: 2014-Aug-20 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1137
    • View Profile
    • My GLBasic code archiv
Re: iOS8: Landscape mode got x/y swapped.
« Reply #4 on: 2014-Aug-20 »
Is it really worth to bother about bugs that happen with a beta sdk on a beta os? Shouldnt we wait to see if its still there when its final?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: iOS8: Landscape mode got x/y swapped.
« Reply #5 on: 2014-Aug-20 »
This bug will been happens in the final iOS8 as well. Im sure, this was in Beta 5 and Apple have even noticed and documented the API change about windows bounds here. In the previous iOS, the app have allways been started in the Portrait mode and then techincal rotate the surface. This is no longer been happens in iOS8. The window bounds will now returns the same bounds the user hold the device in iOS8, not the portrait bounds.

This is something what "sensor" works for Android in glbasic in manifest.xml (rather than its was allways used "portrait").
 
Howover im do pretty sure its only require a few line changes as seen in the above link. Its all looks its a windows bounds issue.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: iOS8: Landscape mode got x/y swapped.
« Reply #6 on: 2014-Aug-21 »
https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html under Unified Storyboards for Universal Apps. This is property effected this issue.

So im thinks this is required to been fixed for countinue iOS support in the future, before Apple force us to uses xCode 6, which was happens with iOS7. But that is not soon, but more far. This can wait after the official xCode 6/iOS8 release.

For me, property its only require few lines of change and is only about Windows Bounds as seen on screenshot.
« Last Edit: 2014-Aug-25 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10814
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: iOS8: Landscape mode got x/y swapped.
« Reply #7 on: 2014-Aug-29 »
I try this fix now:
Code: (glbasic) [Select]
// CGRect rect = [[UIScreen mainScreen] applicationFrame]; // GF: broken in iOS8 - depending on orientation
CGRect rect;
if (self.view.frame.size.width < self.view.frame.size.height)
rect = CGRectMake(self.view.frame.origin.y, self.view.frame.origin.x, self.view.frame.size.height, self.view.frame.size.width);
else
rect = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);

I fear there's still a problem, when you return (multitasking) to an app and changed the orientation in between.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: iOS8: Landscape mode got x/y swapped.
« Reply #8 on: 2014-Aug-29 »
Yes its property CGRect that have been changed and will now allways been in the correct orientation, regardless the orientation the user is holdning. That means you should not swap X/Y at all on iOS8 on the CGRectMake.

So im petty sure, rect = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height); should now allways required to been called on iOS8 and up, regardless the user device orientation. This is some what "sensor" is doing on Android, when the surface changes (which before iOS was allways "started" in the portrait mode).

Also yes, its property required to been called and checking when the app is resuming too and call the function that checking the frame size. This can still been done on all iOS versions.

So im thinks if you detect iOS8, then that last line should allways been executed (no x/y swap). But if iOS7 and down is detected (or below), then you should still do the X/Y swap thing.

« Last Edit: 2014-Aug-29 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10814
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: iOS8: Landscape mode got x/y swapped.
« Reply #9 on: 2014-Aug-29 »
On ios7 the above fails. I use Mainscreen.bounds instead of the this.... thing.

Gesendet von meinem GT-N7100 mit Tapatalk


Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: iOS8: Landscape mode got x/y swapped.
« Reply #10 on: 2014-Aug-29 »
im have edited my post (because im could not remove it anymore). You need to checkout which iOS system its running, before executing.

here is what im saw in the link about the issue (im guess we have a similar issue like this):
Code: (glbasic) [Select]
+ (CGSize)screenSize {
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
        return CGSizeMake(screenSize.height, screenSize.width);
    } else {
        return screenSize;
    }
}

PS. SETORIENTATION should not been effected at all. Its do still orientation correct on the device. Its only a x/y issue.
« Last Edit: 2014-Aug-30 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: iOS8: Landscape mode got x/y swapped.
« Reply #11 on: 2014-Aug-30 »
edited:
Yep, its bot broken now, so 12.308 cant been used.

By now on iPad1, X/Y is now just swapped on either orientation (regaardless you started up in portrait or landscape). Same happens on iOS8 now.

So im thinks this should fix the issue:

Code: (glbasic) [Select]
CGRect rect;
if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7.1)
{ if (self.view.frame.size.width > self.view.frame.size.height)
rect = CGRectMake(self.view.frame.origin.y, self.view.frame.origin.x, self.view.frame.size.height, self.view.frame.size.width);
else
rect = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);
}
else
rect = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);

rect = CGRectMake(self.view.frame.origin.y, self.view.frame.origin.x, self.view.frame.size.height, self.view.frame.size.width); is no longer required in iOS8 at all.
 
« Last Edit: 2014-Aug-30 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
This bug have still not fixed in iOS8, but its refixed again in iOS7. That was most important from the previous version.

Don't y/x swap, regaardless orientation in IOS8 (as im wrote with code previous). This is due iPhone 6 does now supports both landscape and portrait, and that is property why Apple did that change in iOS8. Im gonna thinks Apple is right in this one really.

Im do thinks we wait after the official release and then get the bug fixed using the code im gave eailer in this thread (untested, but its give the idea).
« Last Edit: 2014-Sep-14 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline DaCarSoft

  • Community Developer
  • Mr. Polyvector
  • ******
  • Posts: 182
    • View Profile
Gernot: If you like, I think that I can help you, like in past versions 

I think that could be a good idea to leave open the little part of Xcode that I helped to fix in the past. In that way it could be easier to fix this kind of problems.  ;)

"Si quieres resultados distintos... no hagas siempre lo mismo" - Albert Einstein.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
the whole startup should have been done with source code in same way as happens with Android. That would been have avoid this kind of issues.

Only rect = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height); is required on iOS8 and up.

There is also some code sign issue, but its with icloud. This is howover a quite different issue and not all would see this anyway.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.