gpt4 book ai didi

ios - 更新后应用程序启动弹出警报 View

转载 作者:行者123 更新时间:2023-11-29 02:56:57 25 4
gpt4 key购买 nike

我想在更新后添加一个带有信息的警报 View ,新版本的应用程序有什么新功能!

我使用这段代码:

BOOL isRunMoreThanOnce = [[NSUserDefaults standardUserDefaults] boolForKey:@"isRunMoreThanOnce"];
if(!isRunMoreThanOnce){
// Show the alert view

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Achtung" message:@"Version 1.5" delegate:self cancelButtonTitle:@"OK..!" otherButtonTitles:nil, nil];
[alert show];
// Then set the first run flag
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isRunMoreThanOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

但此警报仅在首次启动时显示一次,我如何检查捆绑版本,并在更新后首次启动时显示警报!

感谢您的帮助

最佳答案

我会将当前应用程序版本号保存在 NSUserDefaults 中,然后当您更新应用程序时,使用保存的版本号检查新版本号。

要获取应用程序版本号,您可以使用以下命令

NSString * appVersionString = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

引用这个question了解更多详情

关于ios - 更新后应用程序启动弹出警报 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23766574/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com