From 985382559e2258af34fa1c76e5fe0431def99456 Mon Sep 17 00:00:00 2001 From: Katsuyoshi Ito Date: Sat, 30 Jan 2016 08:51:50 +0900 Subject: [PATCH] use CFBundleShortVersionString instead of CFBundleVersionString. Currently Apple uses CFBundleShortVersionString as a App version. --- README.md | 4 ++-- TWSReleaseNotesView/TWSReleaseNotesView.m | 4 ++-- .../TWSReleaseNotesViewSample/RootViewController.m | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3bdb763..a548285 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ TWSReleaseNotesView is a simple way to address those issues. It comes with a str if (![TWSReleaseNotesView isAppOnFirstLaunch] && [TWSReleaseNotesView isAppVersionUpdated]) { // Create the release notes view - NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]; TWSReleaseNotesView *releaseNotesView = [TWSReleaseNotesView viewWithReleaseNotesTitle:[NSString stringWithFormat:@"What's new in version %@:", currentAppVersion] text:@"• Great new feature\n• Annoying bug wiped away\n• Optimizations and other great stuff!\n• Additional performance and stability improvements" closeButtonTitle:@"Close"]; // Show the release notes view @@ -45,7 +45,7 @@ TWSReleaseNotesView is a simple way to address those issues. It comes with a str if ([TWSReleaseNotesView isAppVersionUpdated]) { // Setup a remote release notes view - NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]; [TWSReleaseNotesView setupViewWithAppIdentifier:@"XXXXXXXXX" releaseNotesTitle:[NSString stringWithFormat:@"What's new in version %@:", currentAppVersion] closeButtonTitle:@"Close" completionBlock:^(TWSReleaseNotesView *releaseNotesView, NSString *releaseNotesText, NSError *error){ if (error) { diff --git a/TWSReleaseNotesView/TWSReleaseNotesView.m b/TWSReleaseNotesView/TWSReleaseNotesView.m index 1567145..afe91e3 100644 --- a/TWSReleaseNotesView/TWSReleaseNotesView.m +++ b/TWSReleaseNotesView/TWSReleaseNotesView.m @@ -192,7 +192,7 @@ + (BOOL)isAppVersionUpdated { // Read stored version string and current version string NSString *previousAppVersion = [[NSUserDefaults standardUserDefaults] stringForKey:kTWSReleaseNotesViewVersionKey]; - NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]; // Flag app as updated if a previous version string is found and it does not match with the current version string BOOL isUpdated = (previousAppVersion && ![previousAppVersion isEqualToString:currentAppVersion]) ? YES : NO; @@ -475,7 +475,7 @@ - (void)dismiss + (void)storeCurrentAppVersionString { // Store current app version string in the user defaults - NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]; [[NSUserDefaults standardUserDefaults] setObject:currentAppVersion forKey:kTWSReleaseNotesViewVersionKey]; [[NSUserDefaults standardUserDefaults] synchronize]; } diff --git a/TWSReleaseNotesViewSample/TWSReleaseNotesViewSample/RootViewController.m b/TWSReleaseNotesViewSample/TWSReleaseNotesViewSample/RootViewController.m index f36c7bf..f4c44d8 100644 --- a/TWSReleaseNotesViewSample/TWSReleaseNotesViewSample/RootViewController.m +++ b/TWSReleaseNotesViewSample/TWSReleaseNotesViewSample/RootViewController.m @@ -99,7 +99,7 @@ - (void)viewDidAppear:(BOOL)animated - (void)showLocalReleaseNotesView { // Create the release notes view - NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]; TWSReleaseNotesView *releaseNotesView = [TWSReleaseNotesView viewWithReleaseNotesTitle:[NSString stringWithFormat:@"What's new in version\n%@:", currentAppVersion] text:@"• Create custom stations of your favorite podcasts that update automatically with new episodes\n• Choose whether your stations begin playing with the newest or oldest unplayed episode\n• Your stations are stored in iCloud and kept up-to-date on all of your devices\n• Create an On-The-Go playlist with your own list of episodes\n• Playlists synced from iTunes now appear in the Podcasts app\n• The Now Playing view has been redesigned with easier to use playback controls\n• Addressed an issue with resuming playback when returning to the app\n• Additional performance and stability improvements" closeButtonTitle:@"Close"]; // Show the release notes view @@ -108,7 +108,7 @@ - (void)showLocalReleaseNotesView - (void)showRemoteReleaseNotesView { - NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString *currentAppVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]; [TWSReleaseNotesView setupViewWithAppIdentifier:@"329670577" releaseNotesTitle:[NSString stringWithFormat:@"What's new in version %@:", currentAppVersion] closeButtonTitle:@"Close" completionBlock:^(TWSReleaseNotesView *releaseNotesView, NSString *releaseNotesText, NSError *error){ if (error) {