CheckVersion_Swift
CheckVersion_Swift 是一款轻量级的 Swift 版本的框架,框架功能:根据 Apple 提供的 API 去请求 JSON,根据 JSON 中的版本号决定是否去更新原生 App。更新提示的内容可以自定义,也可以是 JSON 中提供的内容。
写作 CheckVersion_Swift 框架初衷
通常在做 App 版本检查更新功能的时候,都是后台服务器为我们提供一个获取 App 最新版本信息的接口,并且在每次新版本更新后,都需要人工在后台更改版本信息,这样做其实也可以的,但是费事且不及时。
其实苹果提供了一个很友好的 iTunes 接口,供我们获取 App Store 中 App 当前的最新信息。
示例
要运行示例项目,首先克隆仓库,然后在 Example 目录中运行 pod install
。
安装
CheckVersion_Swift 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:
pod 'CheckVersion_Swift'
使用
/// check version
///
/// - Parameters:
/// - appId: app id,eg: 414478124 of the wechat
/// - customContent: custom content,if the string is nil and the count of the string is greater
/// than zero,use custom content;Otherwise,use the content of the request data
public class func checkVersion(_ appId: String, _ customContent: String?)
// 直接显示接口中的更新内容
CheckVersion.checkVersion(kAppId, nil)
// 显示自定义的更新内容
CheckVersion.checkVersion(kAppId, "自定义的更新内容...")
许可
CheckVersion_Swift遵循MIT许可。有关更多信息,请参阅LICENSE文件。
作者
如果你有任何建议,可以关注我的公众号:iOS开发者进阶
,直接留言,留言必回。