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

标签 ios

我想在更新后添加一个带有信息的警报 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/

相关文章:

ios - 如何使用 Swift 和 PDFKit 在交互式 pdf 文件中使用自定义文本完成注释?

iphone - Xcode 中的条件编译

ios - Apple Mach-O 链接器错误。体系结构 armv7 的 undefined symbol

ios - 数组中的随机数而不连续两次重复相同的数字?

ios - 比较 bundle 版本

iphone - 当手机丢失时,任何人都可以从 iPhone 中的应用程序访问我的 sqlite3 数据库吗

ios - 包含另一个 TableView 的 Tableview 单元格的动态高度

objective-c - 在 XCode 中使用 Pascal 库

ios - 如何叠加相机捕获的图像?

ios - 无法将 UITableViewCell 类型的值转换为 "ActuTblCell"