You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
I'm having the same problem. I don't have any preview interface orientation modifiers on the previews, I even tried adding one but it's the same.
Based on my initial investigation, it looks like snapshot previews assumes tests will run with a host app in place. I'm currently trying this in a Swift package where my product is a Swift library. I'm actively looking for ways to get this to work but I'd love if this is something known and if there's a way forward.
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:
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.The text was updated successfully, but these errors were encountered: