前言
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 Store
中 App
當(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 性能考慮