【发布时间】:2018-07-31 09:28:29
【问题描述】:
我正在尝试取消勾选“设备方向设置”,留下纵向选项,但它不起作用。在 Android 中它不会旋转,但在 iOS 中会旋转,我不知道为什么。无论我在哪个窗口,它都会在我的整个应用程序中旋转。 您知道锁定由方向引起的旋转的另一种替代方法吗?
这是我的 Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>NEXT PORTAL</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>7.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) necesita acceder a su cámara para poder escanear el código QR.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSMainNibFile</key>
<string>LaunchScreen</string>
<key>NSMainNibFile~ipad</key>
<string>LaunchScreen</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) would like to your microphone (for videos)</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>$(PRODUCT_NAME) necesita acceder a la galería para adjuntar fotos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) necesita acceder a la galería para adjuntar fotos.</string>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
【问题讨论】:
-
在 iOS 文件夹中的 Info.plist 文件中,尝试删除:UIInterfaceOrientationLandscapeLeft 和 UIInterfaceOrientationLandscapeRight
-
我的 Info.plist 文件中没有这些键:S
-
奇怪!你能检查下ios文件夹>你的项目名称文件夹>info.plist
-
会像
<key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> -
检查我的 Info.plist,我编辑了问题。
标签: ios react-native mobile orientation