{"id":21389363,"url":"https://github.com/isaced/isfirversioncheck","last_synced_at":"2025-07-13T15:33:05.702Z","repository":{"id":56915197,"uuid":"64203330","full_name":"isaced/ISFIRVersionCheck","owner":"isaced","description":"fir 版本自动检测，有新版本弹 Alert 前往更新","archived":false,"fork":false,"pushed_at":"2016-07-27T02:25:15.000Z","size":88,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T12:59:19.156Z","etag":null,"topics":["fir"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isaced.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-26T08:18:51.000Z","updated_at":"2022-02-14T16:00:51.000Z","dependencies_parsed_at":"2022-08-20T20:50:38.171Z","dependency_job_id":null,"html_url":"https://github.com/isaced/ISFIRVersionCheck","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaced%2FISFIRVersionCheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaced%2FISFIRVersionCheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaced%2FISFIRVersionCheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaced%2FISFIRVersionCheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaced","download_url":"https://codeload.github.com/isaced/ISFIRVersionCheck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225896396,"owners_count":17541487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fir"],"created_at":"2024-11-22T12:26:06.497Z","updated_at":"2024-11-22T12:26:07.214Z","avatar_url":"https://github.com/isaced.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ISFIRVersionCheck\n基于 fir 对比 build 版本号自动检测新版本信息，有新版本弹 Alert 前往更新。\n\n![screenshot](https://raw.githubusercontent.com/isaced/ISFIRVersionCheck/master/screenshot.png)\n\n### CocoaPods\n\n```\npod 'ISFIRVersionCheck'\n```\n\n### 设置\n\n可以在 AppDelegate 中配置应用在 fir 上的 ID，和其帐号的 api_token. (可在 fir 后台查看)，以下两种方式任选其一即可\n\n```\n// 使用 api_token 初始化，根据 bundle id 自动匹配应用\n[ISFIRVersionCheck setAPIToken:@\"\"];\n\n// 使用 app_id 和 api_token 初始化 \n[ISFIRVersionCheck setAppID:@\"\" APIToken:@\"\"];\n```\n\n### 检测更新\n\n然后在想检测版本更新的地方执行如下方法，当然也可以在 AppDelegate 中执行，Alert 会在版本请求返回成功并比对 build 版本号弹出\n\n```\n[ISFIRVersionCheck check];\n```\n### 用到的接口\n\n- fir.im - 版本检测 : https://fir.im/docs/version_detection\n\n版本比对：当前项目 build 如果小于最新的则弹出 Alert，前往更新 url 取的接口返回值中的 update_url 字段。\n\n更新内容：Alert 中的 changlog 取的是 fir 后台每版本的 \"更新日志\"，对应接口返回中的 changelog 字段，可以随时在 fir 后台修改即生效。\n\n### Build 版本号递增\n\n由于判断新版本是用的 build 字段，所以每次更新编译打包都需要同时更新项目 build 号，所以建议配置 build 自动递增，要是再配合上自动编译、上传脚本就更方便了。\n\nbuild 递增脚本可以参照如下脚本：\n\n```\n# 递增版本号 build\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n```\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaced%2Fisfirversioncheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaced%2Fisfirversioncheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaced%2Fisfirversioncheck/lists"}