iOS app版本更新CheckVersion_Swift

前言

CheckVersion_Swift 是一款輕量級(jí)的 Swift 版本的框架,框架功能:根據(jù) Apple 提供的 API 去請(qǐng)求 JSON ,根據(jù) JSON 中的版本號(hào)決定是否去更新原生 App。更新提示的內(nèi)容可以自定義,也可以是 JSON 中給的內(nèi)容。

寫作 CheckVersion_Swift 框架初衷

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

其實(shí)蘋果提供了一個(gè)很友好的 iTunes 接口,供我們獲取 App StoreApp 當(dāng)前的最新信息。

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?)
// 直接顯示接口中的更新內(nèi)容
CheckVersion.checkVersion(kAppId, nil)
// 顯示自定義的更新內(nèi)容
CheckVersion.checkVersion(kAppId, "自定義的更新內(nèi)容...")

License

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

Author

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

更多文章

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

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

友情鏈接更多精彩內(nèi)容