GLBasic forum

Main forum => Bug Reports => Topic started by: spacefractal on 2014-Aug-16

Title: iOS8: Landscape mode got x/y swapped (not fixed in 12.308).
Post by: spacefractal on 2014-Aug-16
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.
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: Hemlos on 2014-Aug-20
I recieved a report about you wanting to remove this thread, is that correct?
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: Kitty Hello on 2014-Aug-20
oops, no! My question is: What do I need to change? (Detail?)
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: spacefractal 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.
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: kanonet 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?
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: spacefractal 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.

Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: spacefractal 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.
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: Kitty Hello 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.
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: spacefractal 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.

Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: Kitty Hello 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

Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: spacefractal 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.
Title: Re: iOS8: Landscape mode got x/y swapped.
Post by: spacefractal 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.
Title: Re: iOS8: Landscape mode got x/y swapped (not fixed, 12.308).
Post by: spacefractal on 2014-Sep-09
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).
Title: Re: iOS8: Landscape mode got x/y swapped (not fixed in 12.308).
Post by: DaCarSoft on 2014-Sep-19
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.  ;)

Title: Re: iOS8: Landscape mode got x/y swapped (not fixed in 12.308).
Post by: spacefractal on 2014-Sep-19
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.
Title: Re: iOS8: Landscape mode got x/y swapped (not fixed in 12.308).
Post by: spacefractal on 2014-Sep-25
im found a temporary fix to this one:

A possible temporary fix for the swap x/y is remove "landscape support" under "Device Orientation" in xcode, then its will now allways launch in the portrait mode, but you can still uses SETORIENTATION to correct it again. Im can mightbeen not uses this for Karma Miwa (which is a landscape only game), but both my other games would could correct using this.