AppStoreManager 1.3.6

AppStoreManager 1.3.6

Visarut Tippun 维护。



  • 作者
  • Visarut Tippun

AppStoreManager 是一个新的iOS版本检查框架。

📲安装

CocoaPods

AppStoreManager 可在CocoaPods上找到

pod 'AppStoreManager'

Swift Package Manager

  • 文件 > Swift Packages > 添加包依赖
  • 添加 https://github.com/knottx/AppStoreManager.git
  • 选择 "到下一个主版本" 并设置 "1.3.6"

📝如何

代码实现

首先

import AppStoreManager

检查新版本是否可用

  • 可以选择版本检查类型 => .immediately.daily.weekly

    AppStoreManager.shared.checkNewVersion(.immediately) { (isAvailable) in
        if isAvailable {
            //  New Version Available.
        } else {
            //  No New Version.
        }
    }
  • 如果您的应用仅在美国App Store之外可用,则需将 countryCode 设置为您想要搜索的商店的两个字母国家代码。

    查看http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 以获取ISO国家代码列表。

    AppStoreManager.shared.checkNewVersion(.immediately, countryCode: "th") { (isAvailable) in
        if isAvailable {
            //  New Version Available.
        } else {
            //  No New Version.
        }
    }

检查新版本是否可用并显示警告

  • 可以选择版本检查类型 => .immediately.daily.weekly

  • 如果您不需要显示跳过按钮,可以将 canSkip: 设置为 false

    AppStoreManager.shared.checkNewVersionAndShowAlert(.immediately, at: self, canSkip: true)
  • 如果您的应用仅在美国App Store之外可用,则需将 countryCode 设置为您想要搜索的商店的两个字母国家代码。

    查看http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 以获取ISO国家代码列表。

    AppStoreManager.shared.checkNewVersionAndShowAlert(.immediately, countryCode: "th", at: self, canSkip: true)

打开AppStore

```swift
AppStoreManager.shared.openAppStore()
```
  • 如果您的应用仅在美国App Store之外可用,则需将 countryCode 设置为您想要搜索的商店的两个字母国家代码。

    查看http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 以获取ISO国家代码列表。

    AppStoreManager.shared.openAppStore(countryCode: "th")

警告 - 打开AppStore

  • 如果您不需要显示跳过按钮,可以将 canSkip: 设置为 false

  • preferredStyle 默认为 .alert,可选择 .alert.actionSheet 之间的任一选项

    AppStoreManager.shared.showAlertUpdate(at: self, canSkip: true)
  • 如果您的应用仅在美国App Store之外可用,则需将 countryCode 设置为您想要搜索的商店的两个字母国家代码。

    查看http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 以获取ISO国家代码列表。

    AppStoreManager.shared.showAlertUpdate(countryCode: "th",at: self, canSkip: true)

自定义

AppStoreManager

AppStoreManager 支持以下功能

AppStoreManager.shared.configureAlert(title: <String?>, message: <String?>)
//  Default title is "New version available"
//  Default message is "There is an update available. Please update to use this application.", message is optional.

AppStoreManager.shared.configureAlert(updateButtonTitle: <String?>, skipButtonTitle: <String?>)
//  Default updateButtonTitle is "Update"
//  Default skipButtonTitle is "Skip"

📋需求

  • iOS 11.0+
  • Xcode 11+
  • Swift 5.1+