ios启动图LaunchScreen出现缓存和白屏的问题
2023-09-14 09:04:15 时间
下面的代码我朋友试了有用
// 为了每次都读取最新的启动图,所以要在有缓存的时候清除缓,
- (void)removeLaunchScreenCacheIfNeeded {
NSString *filePath = [NSString stringWithFormat:@"%@/Library/SplashBoard", NSHomeDirectory()];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
NSError *error = nil;
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
if (error) {
NSLog(@"清除LaunchScreen缓存失败");
} else {
NSLog(@"清除LaunchScreen缓存成功");
}
}
}