iOS app版本更新CheckVersion_Swift

前言

CheckVersion_Swift 是一款輕量級的 Swift 版本的框架,框架功能:根據 Apple 提供的 API 去請求 JSON ,根據 JSON 中的版本號決定是否去更新原生 App。更新提示的內容可以自定義,也可以是 JSON 中給的內容。

寫作 CheckVersion_Swift 框架初衷

通常在做 App 版本檢查更新功能的時候,都是后臺服務器為我們提供一個獲取 App 最新版本信息的接口,并且在每次新版本更新后,都需要人工在后臺更改版本信息,這樣做其實也可以的,但是費事且不及時。

其實蘋果提供了一個很友好的 iTunes 接口,供我們獲取 App StoreApp 當前的最新信息。

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

CheckVersion_Swift is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'CheckVersion_Swift'

Use

/// 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, "自定義的更新內容...")

License

CheckVersion_Swift is available under the MIT license. See the LICENSE file for more info.

Author

如果你有什么建議,可以關注我,直接留言,留言必回。

更多文章

蘋果技術專家:清后臺反而會增加 iPhone 耗電
Swift中C語言指針的訪問和轉換方法
開源框架 RSA_Swift
iOS SKStoreProductViewController的應用
CocoaPods開源庫的搭建
CocoaPods搭建私有庫
CocoaPods搭建私有庫遇到問題
CocoaPods私有庫的升級維護
SKStoreReviewController之程序內評價
App應用程序圖標的動態(tài)更換
開源框架 MGJRouter_Swift
iOS的MVP設計模式
iOS插件化
iOS FMDB的使用
Swift之ReactiveSwift
OC之ReactiveCocoa
OC之ReactiveCocoa進階
iOS 性能考慮

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容