Flutter:ImagePicker UIApplicationInvalidInterfaceOrientation异常
Flutter: ImagePicker UIApplicationInvalidInterfaceOrientation Exception
我在 iPad 运行 iOS 10.4 上使用 image_picker 和 运行 进入下面的错误,当我执行此调用时 ImagePicker().pickImage(source: ImageSource.gallery)
在仅具有横向(左右)方向的应用程序上。
这在 iOS 模拟器 运行 14+.
上运行良好
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'
*** First throw call stack:
(0x1cef7b3d 0x1c17f067 0x1cef7a85 0x221960b9 0x2219ee67 0x2219ee07 0x2219d427 0x22120aeb 0x221208a9 0x221208a9 0x221208a9 0x2211fee5 0x2211fd71 0x2212b27f 0x2212ac03 0x22218757 0x22217b3f 0x2245cc43 0x223a2983 0x22395c93 0x221178bd 0x1ceb3803 0x1ceb1a55 0x1ceb2017 0x1ce051af 0x1ce04fd1 0x1e5afb41 0x22187a53 0xbe7f7 0x1c5f24eb)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'
terminating with uncaught exception of type NSException
(lldb)
我确实使用以下命令指定应用程序方向,但我发现无论是否使用它都会发生错误。
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight])
.then((_){
runApp(MyApp());
}
);
在我的 Info.plist
文件中选择了相应的设备方向。
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
更新 1:
使用相机时,使用以下命令,选择器在 iOS 10.4.
上工作正常
ImagePicker().pickImage(source: ImageSource.camera)
原来 Info.plist
必须在 UISupportedInterfaceOrientations
数组中有 UIInterfaceOrientationPortrait
项。
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
(在我的实例中,我也必须将它添加到 UISupportedInterfaceOrientations~iPad
数组。)
我在 iPad 运行 iOS 10.4 上使用 image_picker 和 运行 进入下面的错误,当我执行此调用时 ImagePicker().pickImage(source: ImageSource.gallery)
在仅具有横向(左右)方向的应用程序上。
这在 iOS 模拟器 运行 14+.
上运行良好*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'
*** First throw call stack:
(0x1cef7b3d 0x1c17f067 0x1cef7a85 0x221960b9 0x2219ee67 0x2219ee07 0x2219d427 0x22120aeb 0x221208a9 0x221208a9 0x221208a9 0x2211fee5 0x2211fd71 0x2212b27f 0x2212ac03 0x22218757 0x22217b3f 0x2245cc43 0x223a2983 0x22395c93 0x221178bd 0x1ceb3803 0x1ceb1a55 0x1ceb2017 0x1ce051af 0x1ce04fd1 0x1e5afb41 0x22187a53 0xbe7f7 0x1c5f24eb)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'
terminating with uncaught exception of type NSException
(lldb)
我确实使用以下命令指定应用程序方向,但我发现无论是否使用它都会发生错误。
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight])
.then((_){
runApp(MyApp());
}
);
在我的 Info.plist
文件中选择了相应的设备方向。
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
更新 1:
使用相机时,使用以下命令,选择器在 iOS 10.4.
上工作正常ImagePicker().pickImage(source: ImageSource.camera)
原来 Info.plist
必须在 UISupportedInterfaceOrientations
数组中有 UIInterfaceOrientationPortrait
项。
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
(在我的实例中,我也必须将它添加到 UISupportedInterfaceOrientations~iPad
数组。)