AppVersionMonitor 是一款为方便监控 iOS 应用程序版本的软件。
通过它你可以获得以往的版本和安装历史。
运行工程实例,克隆 repo,并且先从实例项目运行 pod install。
iOS8.0 +
AppVersionMonitor 可在 CocoaPods 上使用。要安装 AppVersionMonitor 你只需要在 Podfile
中按照下面的操作即可:
pod "AppVersionMonitor"
// AppDelegatefunc applicationDidFinishLaunching(application: UIApplication) { AppVersionMonitor.sharedMonitor.startup() }
let currentVersion: AppVersion = AppVersion.marketingVersion let versionString: String = AppVersion.marketingVersion.versionString // "1.2.3"
let installedVersions: [AppVersion] = AppVersionMonitor.sharedMonitor.installedVersions
AppVersion.marketingVersion > AppVersion("1.2.3") AppVersion("1.2.3") < AppVersion("3.2.1") AppVersion("1.2.3") < "3.2.1"
switch AppVersionMonitor.sharedMonitor.state { case .Installed: // Do something when app installed. // Happy! // ex. Start tutorial. case .NotChanged: // Do something when version not changed. // Peace // Nothing to do? case .Upgraded(let previousVersion: AppVersion): // Do something when version upgraded. // Yeah! // ex. Migrate App Data. case .Downgraded(let previousVersion: AppVersion): // Do something when version downgraded. (Impossible normally) // What happened? // ex. Purge App Data. }