iOS APP启动页更新失败

2020-02-18  本文已影响0人  不会武功的陈真

如果已经更换了启动图,有些手机启动图更新成功,有些更新失败,则有可能是缓存问题, 在/Library/SplashBoard文件夹里面保存着 启动页的缓存。更新之后删除一次就好了。为啥缓存没有自动更新我也没找到原因,如果有大神明白,留言解惑

代码

#import <UIKit/UIKit.h>

@interface UIApplication (LaunchScreen)
- (void)clearLaunchScreenCache;
@end
#import "UIApplication+LaunchScreen.h"

@implementation UIApplication (LaunchScreen)
- (void)clearLaunchScreenCache {
    NSError *error;
    [NSFileManager.defaultManager removeItemAtPath:[NSString stringWithFormat:@"%@/Library/SplashBoard",NSHomeDirectory()] error:&error];
    if (error) {
        NSLog(@"Failed to delete launch screen cache: %@",error);
    }
}
@end
#import "UIApplication+LaunchScreen.h"

//在需要的地方调用
[UIApplication.sharedApplication clearLaunchScreenCache];
上一篇 下一篇

猜你喜欢

热点阅读