当前位置: 首页 > news >正文

如何配置capacitor 打包的ios app固定竖屏展示?

注:打包ios包需要使用xcode来进行打包,Xcode 提供了为 Apple 平台开发、测试和分发 App 所需的工具,包括预测代码补全、主流编码模型加持的生成式智能功能、高级分析和调试工具,以及适用于 Apple 设备的模拟器。因此打包ios包的前提是需要一台苹果电脑。

找到/ios/App/App/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>traction-digital-twin-mobile-app1</string><key>CFBundleExecutable</key><string>$(EXECUTABLE_NAME)</string><key>CFBundleIdentifier</key><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string><key>CFBundleInfoDictionaryVersion</key><string>6.0</string><key>CFBundleName</key><string>$(PRODUCT_NAME)</string><key>CFBundlePackageType</key><string>APPL</string><key>CFBundleShortVersionString</key><string>$(MARKETING_VERSION)</string><key>CFBundleVersion</key><string>$(CURRENT_PROJECT_VERSION)</string><key>LSRequiresIPhoneOS</key><true/><key>UILaunchStoryboardName</key><string>LaunchScreen</string><key>UIMainStoryboardFile</key><string>Main</string><key>UIRequiredDeviceCapabilities</key><array><string>armv7</string></array><key>UISupportedInterfaceOrientations</key><array><!-- iPhone仅保留竖屏(Home 键在下的正常竖屏) --><string>UIInterfaceOrientationPortrait</string><!-- <string>UIInterfaceOrientationLandscapeLeft</string><string>UIInterfaceOrientationLandscapeRight</string> --></array><key>UISupportedInterfaceOrientations~ipad</key><array><!-- iPad仅保留竖屏(Home 键在下的正常竖屏) --><string>UIInterfaceOrientationPortrait</string><!-- iPad允许倒竖屏 --><string>UIInterfaceOrientationPortraitUpsideDown</string><!-- <string>UIInterfaceOrientationLandscapeLeft</string><string>UIInterfaceOrientationLandscapeRight</string> --></array><key>UIViewControllerBasedStatusBarAppearance</key><true/><!-- 通知权限描述 --><key>NSLocalNotificationUsageDescription</key><string>需要向您发送本地通知,提醒重要事项</string><!-- 后台通知支持(可选,用于后台触发通知) --><key>UIBackgroundModes</key><array><string>remote-notification</string></array><!-- iOS 10+ 通知声音配置(若使用自定义声音,需添加) --><key>UILocalNotificationDefaultSoundName</key><string>default</string> <!-- 使用系统默认声音,自定义声音需放入项目并指定文件名 -->
</dict>
</plist>

根据以下注释配置,将

<string>UIInterfaceOrientationLandscapeLeft</string>

 <string>UIInterfaceOrientationLandscapeRight</string>

这两行注释掉,  <key>UISupportedInterfaceOrientations</key>这个是指对iPhone屏幕横竖屏的设置;<key>UISupportedInterfaceOrientations~ipad</key> 则是指对iPad屏幕横竖屏的设置,保险起见,也把iPad的

<string>UIInterfaceOrientationLandscapeLeft</string>

 <string>UIInterfaceOrientationLandscapeRight</string>这两个注释掉,然后重新运行ionic capacitor build ios进行打包安装,xcode打开项目后,建议检查一遍xcode上面的打包配置,检查步骤如图:

安装成功后的效果图:

以上是自己在项目里遇到的问题以及解决的方法,浅浅记录一下~


文章转载自:

http://0LwQFg6i.dbjyb.cn
http://qV9a2PeK.dbjyb.cn
http://JyHVOep2.dbjyb.cn
http://Pl3jPB0k.dbjyb.cn
http://azV5UBsM.dbjyb.cn
http://MLdIfG5H.dbjyb.cn
http://uGfHuaSO.dbjyb.cn
http://YVTgupCU.dbjyb.cn
http://5kieBEKw.dbjyb.cn
http://hdO3zoiF.dbjyb.cn
http://tWMi9eIT.dbjyb.cn
http://OhP31ErR.dbjyb.cn
http://XcE0jaaD.dbjyb.cn
http://EFS5P65o.dbjyb.cn
http://ONI6JPix.dbjyb.cn
http://wluwUXJa.dbjyb.cn
http://bLDz4tpz.dbjyb.cn
http://rgubiqL0.dbjyb.cn
http://MhgKUZFD.dbjyb.cn
http://H46XJhdv.dbjyb.cn
http://ml00aI5R.dbjyb.cn
http://oynJ8eDp.dbjyb.cn
http://KnM7QLJ8.dbjyb.cn
http://5yifSlnH.dbjyb.cn
http://6fbxJTrc.dbjyb.cn
http://bhMzTNsj.dbjyb.cn
http://BWggZgel.dbjyb.cn
http://hlOamxQt.dbjyb.cn
http://n9SLDGv4.dbjyb.cn
http://gchwOkiN.dbjyb.cn
http://www.dtcms.com/a/378079.html

相关文章:

  • 解锁Roo Code的强大功能:深入理解上下文提及(Context Mentions)
  • BilldDesk:基于Vue3+WebRTC+Nodejs+Electron的开源远程桌面控制
  • 上网管理行为-ISP路由部署
  • 立体校正(Stereo Rectification)的原理
  • 经营帮会员经营:全方位助力企业高效发展,解锁商业新可能
  • 无人机飞控系统原理深度解析
  • 预测赢家-区间dp
  • 2025年- H123-Lc69. x的平方根(技巧)--Java版
  • Visual Studio 2026 震撼发布!AI 智能编程时代正式来临
  • 2023年EAAI SCI1区TOP,基于差分进化的自适应圆柱矢量粒子群优化无人机路径规划,深度解析+性能实测
  • 强化学习框架Verl运行在单块Tesla P40 GPU配置策略及避坑指南
  • HTML 完整教程与实践
  • 前端开发易错易忽略的 HTML 的 lang 属性
  • html中css的四种定位方式
  • GCC 对 C 语言的扩展
  • 基于STM32的智能语音识别饮水机系统设计
  • 基于ubuntu-base制作Linux可启动镜像
  • 速通ACM省铜第一天 赋源码(The Cunning Seller (hard version))
  • springboot+vue旧物回收管理系统(源码+文档+调试+基础修改+答疑)
  • Reactnative实现远程热更新的原理是什么
  • OCDM 波形通信感知一体化:从原理到 MATLAB 实现
  • 智源研究院新研究:突破物理世界智能边界的RoboBrain 2.0,将重构具身AI能力天花板
  • 容器应用学习笔记:containerd 篇
  • [特殊字符]AutoSQT 2025第二届汽车软件质量与测试峰会开幕首日盛况直击
  • MCP模型上下文协议以及交互流程
  • iOS App 性能监控与优化实战 如何监控CPU、GPU、内存、帧率、耗电情况并提升用户体验(uni-app iOS开发调试必备指南)
  • (Arxiv-2025)重构对齐提升了统一多模态模型的性能
  • 在亚马逊平台激烈的竞争赛道上
  • AI驱动的知识管理指南:基于Atlassian Intelligence和Rovo构建企业级知识管理系统
  • Redis 键(Key)的命令