iOS检测版本更新
来源:互联网 发布:乐敦美白淡斑精华知乎 编辑:程序博客网 时间:2024/06/07 10:12
项目介绍:
具体实现代码参考源码https://github.com/wolfhous/HSUpdateApp
文件小巧,轻便:
支持cocoapods:
pod 'HSUpdateApp'
用法:
#import "HSUpdateApp.h"
/** 一行代码实现检测app是否为最新版本。appId,bundelId,随便传一个 或者都传nil 即可实现检测。 @param currentVersion 返回当前版本号 @param storeVersion 返回商店版本号 @param openUrl 跳转到商店下载的链接 @param isUpdate 是否需要更新 @return */ [HSUpdateApp hs_updateWithAPPID:nil withBundleId:nil block:^(NSString *currentVersion, NSString *storeVersion, NSString *openUrl, BOOL isUpdate) { }];
问题1:这样审核能通过?
答1:亲测能通过,没问题的。
问题2:我项目APP ID 在哪里看?
答2:itunes connect 》我的APP》APP ID
问题3:假如我的项目还没上线,也没有APP ID 怎么搞?
答3:
--直接利用自动检测,appId和bundelId都传nil即可。
--或者去 itunes connect 申请一个APP,就会有对应的APP ID。
--如果你连开发者账号都没有,那就先用demo里面的APP ID 测试吧,上线的时候改过来即可。
实现思路
1.本地检测项目版本号;
NSDictionary *infoDic=[[NSBundle mainBundle] infoDictionary];NSString *currentVersion=infoDic[@"CFBundleShortVersionString"];
2.联网检测项目在AppStore上的版本号;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/cn/lookup?id=%@",appId]]];NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {}];[task resume];
3.比较版本号,可选提供跳转到手机自带的AppStore项目页面供用户下载的地址;
https://itunes.apple.com/us/app/id1104867082?ls=1&mt=8
下载该GitHub源码请点我
阅读全文
0 0
- iOS 检测版本更新
- iOS 检测版本更新
- IOS检测版本更新
- iOS检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- IOS 版本更新检测
- iOS 检测版本更新
- iOS 检测版本更新
- iOS --检测更新版本
- ios检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- iOS 检测版本更新
- Hibernate框架学习之注解映射实体类
- J2EE J2SE J2ME EJB
- bin(二进制文件)
- Spring Boot 拦截器
- 【知识整理】app应用上架申请所需材料
- iOS检测版本更新
- keepalived单实例主备模式
- adb总结
- Splay模板
- python seek
- 写一个递归函数DigitSum(n),输入一个非负整数,返回组成它的数字之和,例如,调用DigitSum(1729),则应该返回1+7+2+9,它的和是19
- 四大组件之ContentProvider
- 简单网页计算器代码
- N