iOS App LaunchScreen storyboard not work bug All In One
iOS App LaunchScreen storyboard not work bug All In One
bug,iOS LaunchScreen storyboard 不显示图片
复现步骤 & 问题排查
- 删除后,新建
Launch Screen.storyboard
默认的运行成功 ✅
- 添加 Label View 不设置,运行成功 ✅
- 添加 Image View 不设置,选择 background 图片 ,运行失败 ❌ ???问题在这里
- 添加 Image View 不设置,选择
其他
图片 运行成功 ✅???
问题在这里
background 图片 太大; ❌
格式不支持 ???png/ jpg; ❌
文件夹名称冲突,或名称与配置文件不一致 ???❌
- 添加 Image View 设置,选择
其他
图片,添加约束条件
运行成功 ✅
- 添加 Image View 设置,选择 Assets 文件夹
外面的
图片,运行成功 ✅
删除重新创建, 配置缓存 bug
BeiJingTourth.xcodeproj/project.pbxproj
/* Begin PBXFileReference section */
70B12814282CA5AF000716FC /* 北京旅游.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "北京旅游.app"; sourceTree = BUILT_PRODUCTS_DIR; };
70B12817282CA5AF000716FC /* BeiJingTourthApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeiJingTourthApp.swift; sourceTree = "<group>"; };
70B12819282CA5AF000716FC /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
70B1281B282CA5B1000716FC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
70B1281E282CA5B1000716FC /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
70B1282C282D2278000716FC /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
70B1282E282D3574000716FC /* test.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = test.png; path = Assets.xcassets/Bug/Image.imageset/test.png; sourceTree = "<group>"; };
70B12830282D35A1000716FC /* test-dark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "test-dark.png"; path = "Assets.xcassets/Bug/Image.imageset/test-dark.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
project.pbxproj
Info.plist
70B12823282CA5B1000716FC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"BeiJingTourth/Preview Content\"";
DEVELOPMENT_TEAM = GPGP7L32J5;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = BeiJingTourth/Info.plist;
//...
};
name = Debug;
};
bug still ??? why, WTF
temporary solution ✅
使用 Assets.xcassets
外面的根目录下 image 才可以正常渲染 Launch Screen 的背景图片,Why???
https://stackoverflow.com/a/64000507/5934465
iOS 15 bug
version bug
- iOS 14 ✅
- iOS 15 ❌
??? iOS 14 ✅,然后切换到 iOS 15 突然好了✅
solutions ???
1.查看图片尺寸是否正确,是否添加约束
2.检查TARGETS → General → App Icons and Launch Images 下 Launch Screen File 设置是否是 LaunchScreen 这个同名的 storyboard 文件
3.图片资源不能放置在 Assets.xcasset 文件夹中, 要直接拖拽到与 Assets.xcasset 文件夹同层的项目根目录下 ✅, 可以但是不推荐,无法自适应 Dark 模式 👎
4.卸载 app,重新构建 Command+R
- 可以通过清理以下文件夹编译缓存文件 ✅
~/Library/Developer/Xcode/DerivedData
- 清理缓存
import UIKit
public extension UIApplication {
func clearLaunchScreenCache() {
do {
try FileManager.default.removeItem(atPath: NSHomeDirectory()+"/Library/SplashBoard")
} catch {
print("Failed to delete launch screen cache: \\(error)")
}
}
// UIApplication.shared.clearLaunchScreenCache();
Library 文件夹中有一个名为 SplashBoard
的文件夹,该文件夹是启动屏缓存
的存储位置
https://www.jianshu.com/p/1cc8b3a74f08
https://stackoverflow.com/questions/63978396/launch-screen-not-working-on-ios-14-with-xcode-12
https://developer.apple.com/forums/thread/665358
https://stackoverflow.com/questions/36947371/ios-xcode-launchscreen-storyboard-not-displaying
refs
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/launch-screen/
©xgqfrms 2012-2025
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16263583.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2021-05-12 前端可视化布局生成器 All in One
2020-05-12 DDD
2020-05-12 skills share & free videos
2020-05-12 Dark Web & 暗网 & Tor
2020-05-12 CV
2020-05-12 域名
2020-05-12 召回 & 召回算法 All In One