Giter VIP home page Giter VIP logo

isfirversioncheck's Introduction

ISFIRVersionCheck

基于 fir 对比 build 版本号自动检测新版本信息,有新版本弹 Alert 前往更新。

screenshot

CocoaPods

pod 'ISFIRVersionCheck'

设置

可以在 AppDelegate 中配置应用在 fir 上的 ID,和其帐号的 api_token. (可在 fir 后台查看),以下两种方式任选其一即可

// 使用 api_token 初始化,根据 bundle id 自动匹配应用
[ISFIRVersionCheck setAPIToken:@""];

// 使用 app_id 和 api_token 初始化 
[ISFIRVersionCheck setAppID:@"" APIToken:@""];

检测更新

然后在想检测版本更新的地方执行如下方法,当然也可以在 AppDelegate 中执行,Alert 会在版本请求返回成功并比对 build 版本号弹出

[ISFIRVersionCheck check];

用到的接口

版本比对:当前项目 build 如果小于最新的则弹出 Alert,前往更新 url 取的接口返回值中的 update_url 字段。

更新内容:Alert 中的 changlog 取的是 fir 后台每版本的 "更新日志",对应接口返回中的 changelog 字段,可以随时在 fir 后台修改即生效。

Build 版本号递增

由于判断新版本是用的 build 字段,所以每次更新编译打包都需要同时更新项目 build 号,所以建议配置 build 自动递增,要是再配合上自动编译、上传脚本就更方便了。

build 递增脚本可以参照如下脚本:

# 递增版本号 build
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"

License

MIT

isfirversioncheck's People

Contributors

isaced avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.