Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

iOS 6 Orientation Crash
Started by SegaBoy Sep 16 2012 08:35 PM

- - - - -
48 replies to this topic
[TOPIC CONTROLS]
Page 1 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

So I've just updated xCode and got hold of iOS6 - late I know.

But unfortunately noticing that my app is crashing shortly after launch on the xCode Simulator. The app is intended to be used solely in one landscape orientation and worked on device/simulator prior to iOS6.

However now the app boots up - show the menu screen and shortly crashes with the following error:

Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES

Does anybody have nay knowledge of this? Not sure whether iOS 6 needs any changes to the build.settings file, currently I have the following for orientation settings:

settings = {
	orientation = {
		default = "landscapeLeft",
		supported = {"landscapeLeft"},
	},

Which as I said worked fine on iOS5.

Any help would be appreciated.
uid: 33275 topic_id: 31056 reply_id: 331056


[TOPIC: post.html]
#2

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

P.S Think it could be related to this - Game Center on iOS6 in landscape only orientated apps:

http://stackoverflow.com/questions/12427979/ios6-gamecenter-authentication-in-landscape-only-app-throws-uiapplicationinvali

I've reported the bug with Apple as it seems to be an issue with iOS6 - however would appreciate if anybody has any workarounds or facing a similar issue?

P.P.S 100% Game Center related as I stopped the initiation call to GC and voila - no crash!
uid: 33275 topic_id: 31056 reply_id: 124142


[TOPIC: post.html]
#3

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

So Apple seem aware of this bug and issues the following work around, not sure whether that helps us with Corona:

Game Center
Landscape-only apps that invoke a portrait-only view controller (such as the Game Center login screen) will cause the app to crash.
Workaround:

Apps should provide the delegate method application:supportedIntefaceOrientationsForWindow and ensure that portrait is one of the returned mask values.
When a UIBNavigationController is involved, subclass the UINavigationController and overriding supportedInterfaceOrientations.

I'd appreciate it if anybody from Corona would be able to chip in with a comment as to whether this is useful for us - hoping Apple will squash this bug before iOS is put on general release, but fearing they might not.
uid: 33275 topic_id: 31056 reply_id: 124149


[TOPIC: post.html]
#4

Kimberly Horne

[GLOBAL: userInfoPane.html]
Kimberly Horne
  • Enthusiast

  • 33 posts
  • Corona SDK

We were hit with this as well. If your game only supports landscape, try the following:

Make sure your build.settings orientation block contains the following:

default = "landscapeRight",
content = "landscapeRight",
supported =
{
"landscapeLeft", "landscapeRight", "portrait"
},

You need to specify that you support all three orientations, but that the default is a landscape and that the content is always landscape. Below, in your iphone.plist block, ensure you have the following:

UIInterfaceOrientation = "UIInterfaceOrientationLandscapeRight",

UISupportedInterfaceOrientations =
{
"UIInterfaceOrientationLandscapeRight", "UIInterfaceOrientationPortrait"
},

This allows the GC to come up. It'll be in portrait orientation rather than landscape, but at least your app isn't crashing.
uid: 117383 topic_id: 31056 reply_id: 124195


[TOPIC: post.html]
#5

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

Thanks Kimberly - works like a charm.
uid: 33275 topic_id: 31056 reply_id: 124204


[TOPIC: post.html]
#6

Kimberly Horne

[GLOBAL: userInfoPane.html]
Kimberly Horne
  • Enthusiast

  • 33 posts
  • Corona SDK

We just found a gotcha - native widgets (like textField) are rendered at a 90 degree rotation. :(

Edit: nix that. Native controls are rendered at 90 degress in landscape mode regardless of the suggestion I made above. Bug being logged now.
uid: 117383 topic_id: 31056 reply_id: 124214


[TOPIC: post.html]
#7

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

We are aware of the GameCenter bug and it's a documented bug from Apple. I think your solution to allow Portrait mode and fix the content at Landscape is a good solution for now.

We are also aware of the native.newTextField and TextBox bug where it doesn't work in Landscape mode. There is also a problem where Autorotation doesn't work for all display objects. Apple changed the way they handle rotation in iOS6 and we are looking into the changes now.
uid: 7559 topic_id: 31056 reply_id: 124248


[TOPIC: post.html]
#8

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

Seems as though build .914 fixes this issue for me.
uid: 33275 topic_id: 31056 reply_id: 124337


[TOPIC: post.html]
#9

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

Build 914 fixes the rotations issues but we don't think it fixes the GameCenter crash. The workaround above is the best solution for now.

There still is one other iOS6 issue we are looking at. Apple removed the ability to display "printf" messages in the Xcode Console so none of the Corona print statements or runtime errors will be displayed. We are trying to find a way to fix that but it's not an easy fix (if we can even do it).

Let us know any other iOS6 problems you find.

Thanks,
Tom
uid: 7559 topic_id: 31056 reply_id: 124366


[TOPIC: post.html]
#10

Kimberly Horne

[GLOBAL: userInfoPane.html]
Kimberly Horne
  • Enthusiast

  • 33 posts
  • Corona SDK

Logging is the only big one left for us that we're 100% sure about although we have some reports of folks having issues with IAP on older 6.0 builds (but we can't reproduce those).

As for the logging, I'm going to try and temporarily replace the print function with one that writes to a file in the document directory. It's not ideal, but at least we can see what's happening after the fact.
uid: 117383 topic_id: 31056 reply_id: 124368


[TOPIC: post.html]
#11

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

It's certainly not the prettiest or efficient bit of code - and I haven't tested it extensively, but this should help anybody who's struggling with the lack of print statements on device in xCode following iOS6/xCode 4.5.

Simply put a blank log.txt file into your build directory and refactor the following code into main.lua:

releaseBuild is a global variable (nasty I know) to decide whether I want to actually print stuff to a file or not for the final build - simply define it above in main.lua and set to true or false.

if releaseBuild then
    function print() end
else
	function print(statement)
		local statement = statement
		--print(tostring(statement))
		local path = system.pathForFile(  "log.txt", system.DocumentsDirectory )               
	    local file = io.open( path, "a+" )
	
		if type(statement) == 'table' then
			local t = statement
			for k,v in pairs(t) do
				if type(v) == 'function' then
					table.remove(t, k)
				end
			end

			local jsonString = json.encode(t)
			
			for k,v in pairs( t ) do
				if v.type ~= 'function' then

					file:write( k .. "=" .. v .. "," )
				end
			end
		else
		-- Creates the file where we save our data if needed
			file:write(statement.."\n")
		end
		
	    io.close( file )
	end
end

You'll have to download the xcappdata file from Xcode and click 'Show Package Contents' to actually be able to check out the log.txt file.

Seriously hoping Corona can work around the print obstacle to avoid having to log print statements to a file.
uid: 33275 topic_id: 31056 reply_id: 124699


[TOPIC: post.html]
#12

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

I also experienced the same type of crash, not with Game Center, but by opening the device's photo library using media.show( media.PhotoLibrary, sessionComplete) on a landscape-only restricted app. The fix noted above also fixes this crash.
uid: 9422 topic_id: 31056 reply_id: 124818


[TOPIC: post.html]
#13

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

I had to modify the fix slightly to get my app to work in both landscape orientations. The original fix displays native objects correctly but all corona display objects are upside-down in one of the landscape orientations. Here's the revised fix:

	orientation = 
		{
		default = "landscapeRight",
                content = {"landscapeRight","landscapeLeft"},
		supported = 
			{
			"landscapeRight","landscapeLeft", "portrait",
			},

		},
uid: 9422 topic_id: 31056 reply_id: 124990


[TOPIC: post.html]
#14

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

Blarg... maybe I spoke too soon. Following the advice here it seems that my Corona apps go into portrait orientation when I rotate the device (or simulator) left 90 degrees (curiously, rotation right works as expected).

Has anyone successfully worked around this issue - i.e. - iOS 6, landscape only orientations, native ui (game center, photo library, text boxes) not crashing, rotate left not causing screen orientation to change to portrait?

uid: 9422 topic_id: 31056 reply_id: 125001


[TOPIC: post.html]
#15

Puzzle Runner

[GLOBAL: userInfoPane.html]
Puzzle Runner
  • Contributor

  • 394 posts
  • Corona SDK

@Stephen I tried the exact same thing as you with the same results. I'm in the same position right now myself: I can support landscapeRight or landscapeLeft, but not both at the same time AND not have GameCenter crash AND not have content switch to portrait mode when the device is put in that orientation.
uid: 36054 topic_id: 31056 reply_id: 125081


[TOPIC: post.html]
#16

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

Everyone, please file a bug with Apple about the GameCenter crash. The more people who file this bug the sooner it will be fixed.
uid: 7559 topic_id: 31056 reply_id: 125129


[TOPIC: post.html]
#17

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

@Tom,

As far as I can tell, the workaround isn't working for me because of a problem with Corona. Unless I'm misunderstanding the information here http://developer.coronalabs.com/content/configuring-projects I should be able to lock Corona's orientation (while allowing native UI elements to auto-rotate) by adding the content parameter in build settings. So the below should lock my Corona content to Landscape orientations while allowing the native stuff to auto rotate:

   orientation = 
    {
        default = "landscapeRight",
        content = 
        {
            "landscapeRight","landscapeLeft"
        },
        supported = 
        {
            "landscapeRight","landscapeLeft","portrait","portraitUpsideDown"
        },      
    },

But what I'm seeing in the simulator and on iOS devices is the Corona content rotating to portrait orientations along with the native stuff. If this worked as I'm understanding the docs to describe then the workaround for the iOS 6 crash detailed above would work for me. Is this a bug or am I not understanding the purpose of the content parameter?

Also, it's not clear to me why I need to set UIInterfaceOrientation and UISupportedInterfaceOrientations in the plist block. Isn't that already being covered by the orientation block?

Thanks for any info you can provide.
uid: 9422 topic_id: 31056 reply_id: 125174


[TOPIC: post.html]
#18

canupa.com

[GLOBAL: userInfoPane.html]
canupa.com
  • Contributor

  • 450 posts
  • Corona SDK

frustrating. we planned to upload our nearly finished game whithin the next weeks. Game Center is deeply integrated and adds a high replay value to the game.

For time being, we could live with game center in portrait mode, while the rest of the game is in landscape mode. But unfortunately the workaround adds more problems.

Stephen already pointed out, that, using the workaround, ALL native elements will rotate when rotating the device ... game center views, web views, native text fields...

Also, the game center view still leads to a crash (tested on a iPad2, iOS6) when opening game center in landscape view. But when holding the device in portrait position, game center opens (in landscape mode!), it doesn't crash and it even stays stable when rotating the device back to landscape position.

I hope Apple fixes this ASAP and we will be able to release the game as planned. *keeping fingers crossed*

-finefin
uid: 70635 topic_id: 31056 reply_id: 125732


[TOPIC: post.html]
#19

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

I hope everyone is filing a bug with Apple so the GameCenter and PhotoPicker crash get fixed. There is nothing we an do on this end to resolve the problem.
uid: 7559 topic_id: 31056 reply_id: 125751


[TOPIC: post.html]
#20

ZippyMind

[GLOBAL: userInfoPane.html]
ZippyMind
  • Enthusiast

  • 48 posts
  • Corona SDK

There are (native) workarounds suggested at StackOverflow for this issue. Is this something that Corona SDK could implement?

http://stackoverflow.com/questions/12522491/crash-on-presenting-uiimagepickercontroller-under-ios6/12575058#12575058
uid: 48484 topic_id: 31056 reply_id: 125901


[TOPIC: post.html]
#21

orz

[GLOBAL: userInfoPane.html]
orz
  • Observer

  • 3 posts
  • Corona SDK

If I understand it correctly, the workaround above just allows the app to rotate to portrait mode, and our app is designed to work in landscape mode only, thus the workaround is not acceptable.

There are already a *true* workaround out there which can only be implemented in native code. It seems Unity already shipped a version with it built in.
http://stackoverflow.com/a/12427983
http://unity3d.com/unity/whats-new/unity-3.5.6

Many games in App Store which are optimized for iPhone 5 and run in landscape only already run seamlessly with Game Center, and we can't ship our game if it looks ugly in portrait.

Is there any good reason for Corona not to have the workaround built in?
uid: 132466 topic_id: 31056 reply_id: 126092


[TOPIC: post.html]
#22

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

@orz, the workaround does keep you game in landscape mode and allows the GameCenter to run in portrait mode when needed. The only problem with that solution is all native objects (e.g., textFields and textBoxes) would also rotate to Portrait mode while the rest of your app was in landscape.

We have looked at some native code solutions and they still allow native objects to rotate, so that's no better than what we have now. We also looked at subclassing the GCK but that has a high chance of being rejected by Apple.

The Unity link didn't mention anything about GC, just that it fixed iOS6 orientation bugs so I don't really know if they found a solution.

The Stackoverflow link talked about a fix but in the end they admitted that there were still problems:
"Yes, like it's written in the post title problem appears in "GameCenter authentication in landscape-only". It seems that GC just doesn't have landscape assets for auth screen for iphone in ios6, so I suspect you won't find a real solution - only workaround described here. That is why you have to allow app to launch in portrait mode when GC wants - but deny portrait in your main view - if you don't want portrait of course. By the way, there is no such a problem in ipad on ios6. – Tertium yesterday"

We are trying to find a solution that works but in the end Apple has to fix this issue.
uid: 7559 topic_id: 31056 reply_id: 126118


[TOPIC: post.html]
#23

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

Tom (or anyone who knows)

Could you please post an example build.settings file that shows the workaround working for a landscape only app that supports *both* landscape orientations? (I understand that native objects will still rotate to portrait)

I've tried many combinations in settings but I still get NON-native assets (ie all the corona display objects) rotating to portrait as well. Worse, if the user starts my app in portrait mode it bungles up all the corona content when they do rotate to landscape.

The workaround originally posted above only supports one landscape orientation. I need to support both, with the ability to open user's image library, without crashing on iOS 6.
uid: 9422 topic_id: 31056 reply_id: 126123


[TOPIC: post.html]
#24

ZippyMind

[GLOBAL: userInfoPane.html]
ZippyMind
  • Enthusiast

  • 48 posts
  • Corona SDK

Just sharing another link with suggestions (native workarounds) for the above issue, don't know if this could be of any help here.

http://grembe.wordpress.com/2012/09/19/here-is-what-i/

Our landscape-only game doesn't have game center integration, however, we have native text fields and photo picker functionalities.

I would really appreciate if there is a workaround/suggestions for this crash issue.
uid: 48484 topic_id: 31056 reply_id: 126153


[TOPIC: post.html]
#25

orz

[GLOBAL: userInfoPane.html]
orz
  • Observer

  • 3 posts
  • Corona SDK

Tom, I rechecked our build.settings and set it as exactly same as Kimberly Horne suggested on comment #3, and now our app keeps landscape. Sorry for the confusion I made.

However the WebView, the only native control we use, still rotates, and even worth it is locked 90 degree rotated when the Portrait Orientation Lock is enabled by user.
I'm still unconvinced that this is something Apple is to fix.

As for Unity, I read some blog article and tweets from developer that they say they fix specifically the Game Center issue, though it's in Japanese and I couldn't find English information about this.
http://akisute.com/2012/09/unity-355-game-center-iad-uiimagepicker.html
uid: 132466 topic_id: 31056 reply_id: 126213



[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]