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

interface orientation errors on all local snapshot tests #161

Open
jrames opened this issue Aug 16, 2024 · 1 comment
Open

interface orientation errors on all local snapshot tests #161

jrames opened this issue Aug 16, 2024 · 1 comment

Comments

@jrames
Copy link

jrames commented Aug 16, 2024

I'm testing out Local Snapshot Generation. I was able to get it working in a simple repo, but in my primary application all of the generated tests fail with the following:

failed - Error Error Domain=UISceneErrorDomain Code=101 "The current windowing mode does not allow for programmatic changes to interface orientation." UserInfo={NSLocalizedDescription=The current windowing mode does not allow for programmatic changes to interface orientation.}

I tried drastically simplifying things by returning a single very simple Preview via snapshotPreviews() and still hit this. It must be related to my project config in some way but I'm not sure. I'm also running on a sim and have tried a few different ones. Any ideas / suggestions would be appreciated.

@jrames jrames changed the title failed - Error Error Domain=UISceneErrorDomain Code=101 "The current windowing mode does not allow for programmatic changes to interface orientation." UserInfo={NSLocalizedDescription=The current windowing mode does not allow for programmatic changes to interface orientation.} interface orientation errors on all local snapshot tests Aug 16, 2024
@noahsmartin
Copy link
Member

Hey @jrames There are a couple things I can think of here. First, are any of your previews directly setting the orientation with previewOrientation(...) If not it would default to portrait and should never attempt to change orientation assuming your simulator is already in portrait. If this is the case, can you try adding a breakpoint in UIKitRenderingStrategy around line 47 and see what the difference is between targetOrientation and windowScene.interfaceOrientation?

Also, are you running on an iPad? If so the app needs to have "UIRequiresFullScreen" set to true in Info.plist in order to programmatically rotate. If you run it on an iPhone it shouldn't have this issue.

Also can you check if you are overriding this method? https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623107-application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants