iOS关于版本更新的问题
// 获取app版本
NSString *app_Version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
版本号判断方法:
//输出YES(服务器大与本地) 输出NO(服务器小于本地)
- (BOOL)compareEditionNumber:(NSString *)serverNumberStr localNumber:(NSString*)localNumberStr {
//剔除版本号字符串中的点
serverNumberStr = [serverNumberStr stringByReplacingOccurrencesOfString:@"." withString:@""];
localNumberStr = [localNumberStr stringByReplacingOccurrencesOfString:@"." withString:@""];
//计算版本号位数差
int placeMistake = (int)(serverNumberStr.length-localNumberStr.length);
//根据placeMistake的绝对值判断两个版本号是否位数相等
if (abs(placeMistake) == 0) {
//位数相等
return [serverNumberStr integerValue] > [localNumberStr integerValue];
}else {
//位数不等
//multipleMistake差的倍数
NSInteger multipleMistake = pow(10, abs(placeMistake));
NSInteger server = [serverNumberStr integerValue];
NSInteger local = [localNumberStr integerValue];
if (server > local) {
return server > local * multipleMistake;
}else {
return server * multipleMistake > local;
}
}
}
代码跳转AppStore:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"app路径链接"]];
iOS关于版本更新的问题的更多相关文章
- iOS 检测版本更新(02)
iOS 检测版本更新 如果我们要检测app版本的更新,那么我们必须获取当前运行app版本的版本信息和appstore 上发布的最新版本的信息. 当前运行版本信息可以通过info.plist文件中的bu ...
- iOS - Harpy版本更新工具兼容版本第三方库
Harpy(兼容版) git地址:https://github.com/yangchao0033/Harpy ###(iOS5-9适配版本,基于ArtSabintsev/Harpy v3.4.5) 提 ...
- iOS检测版本更新
有时候为了需求,我们需要检测app版本更新今天在这里整合下 //获取当前版本号 NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDi ...
- iOS软件版本更新思路
iOS软件更新思路 需要更新版本数组 needUpdateVersions{1.2.61.2.8} 历史版本数组 historyUpdateVersions1.2.41.2.51.2.6 更新数据库1 ...
- ios检查版本更新
场景 在我们使用应用时,一打开应用,如果此应用有新的版本,常常能在应用中给出提示,是否要更新此应用.所以,我们就来看看,版本更新是如何实现的. 应用 苹果给了我们一个接口,能根据应用i ...
- iOS 检测版本更新
如果我们要检测app版本的更新,那么我们必须获取当前运行app版本的版本信息和appstore 上发布的最新版本的信息. 当前运行版本信息可以通过info.plist文件中的bundle versio ...
- ios 实现版本更新检查
注:这里网络请求用的是第三方框架:SVHTTPRequest /* 第一步: 根据应用名称搜索应用,然后根据应用绑定的ID在结果中筛选出我们要找的应用,并取出应用的AppID */ - (void)g ...
- iOS APP版本更新跳转到App Store下载/更新方法
使用下面的连接即可跳转到App Store itms-apps://itunes.apple.com/cn/app/id*********** 其中********* ...
- iOS应用版本更新(自动提醒用户更新代码)
在#import "AppDelegate.h" 文件中的application:(UIApplication *)application didFinishLaunchingWi ...
随机推荐
- iOS:CYLTabBarController的具体使用实例:实现新浪微博的主流框架
使用CocoaPods或者手动集成将CYLTabBarController这个第三方框架导入项目后,截图如下: 在AppDelegate.m类中实现的代码如下: // AppDelegate.m // ...
- Tile based Rendering //后面一段是手机优化建议
https://www.imgtec.com/blog/a-look-at-the-powervr-graphics-architecture-tile-based-rendering/ 一种硬件结构 ...
- NTP for Linux
一.服务概述 NTP(network time protocol 网络时间协议)服务器是用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源做同步化,提供高精度的时间校正,在LAN上与 ...
- http网络通信--页面源代码查看
1.要在andorid中实现网络图片查看,涉及到用户隐私问题,所以要在AndroidManifest.xml中添加访问网络权限 <uses-permission android:name=&qu ...
- Javascript code for soft keyboard
<style> BODY { SCROLLBAR-FACE-COLOR: #f0f0f6; FONT-SIZE: 9pt; BACKGROUND-ATTACHMENT: f ...
- g++编译问题:skipping incompatible /usr/lib//libboost_system.so when searching for -lboost_system
接上. 连接器无法识别libboost_system.so,虽然找到了动态库文件libboost_system.so但不兼容,导致无法完成链接. 这种情况一般都是二进制不兼容(通俗的讲就是,在一台机器 ...
- Cannot call sendError() after the response has been committed(filter问题)
就是因为执行了filter的dofilter方法中 chain.doFilter(request,response)了 执行了两遍 if(){}else{chain.doFilter(request, ...
- Short与Integer互转
int 是4字节, short 是2字节的, 如果将int(Integer)转成short(Short), 那么必须强制转换,否则会报编译异常. 但是, 当int(Integer)是一个final时, ...
- electron的安装
1.安装 node.js https://nodejs.org/en/ 2.安装asar npm install -g asar 3.安装atom https://atom.io/ 4.安装elect ...
- Android 事件分发
引言 项目中涉及到的触摸事件分发较多,例如:歌词模式下,上下滑动滚动歌词,左右滑动切换歌曲.此时,理解事件分发机制显得尤为重要 , 既要保证下方的ViewPager能接收到,又要确保上层View能响应 ...