IOS 开发检测版本升级
来源:互联网 发布:hp m1216nfh 网络扫描 编辑:程序博客网 时间:2024/05/17 04:30
思路: 通过获取appStore已上传的版本的版本号与手机当前该软件的plist文件中版本号对比。
//检测软件更新
-(void)checkSoftUpgrade{
NSString *version = @"";
NSURL *url = [NSURLURLWithString:@"http://itunes.apple.com/lookup?id=805288402"];
ASIFormDataRequest * versionRequest = [ASIFormDataRequestrequestWithURL:url];
[versionRequestsetRequestMethod:@"GET"];
[versionRequestsetDelegate:self];
[versionRequestsetTimeOutSeconds:150];
[versionRequest addRequestHeader:@"Content-Type"value:@"application/json"];
[versionRequeststartSynchronous];
//Response string of our REST call
NSString* jsonResponseString = [versionRequestresponseString];
NSDictionary *loginAuthenticationResponse = [jsonResponseStringobjectFromJSONString];
NSArray *configData = [loginAuthenticationResponsevalueForKey:@"results"];
for (id configin configData)
{
version = [configvalueForKey:@"version"];
download = [config valueForKey:@"trackViewUrl"];
NSLog(@"%@",version);
NSLog(@"%@",[[NSBundlemainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]);
}
//Check your version with the version in app store
if (![versionisEqualToString:[[NSBundlemainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]])
{
UIAlertView *createUserResponseAlert = [[UIAlertViewalloc] initWithTitle:@"New Version!!"message: @"A new version of app is available to download" delegate:selfcancelButtonTitle:@"Cancel"otherButtonTitles:@"Download", nil];
[createUserResponseAlertshow];
}
}
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 1)
{
NSString *iTunesLink = download;
NSLog(@"+++++++%@",iTunesLink);
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:iTunesLink]];
}
}
- IOS 开发检测版本升级
- ios-版本升级检测
- Android版本检测升级
- Android版本检测升级
- Android版本检测升级
- Android版本检测升级
- iOS开发如何设置sqlite版本升级
- iOS开发之 app版本升级流程
- iOS开发检测AppStore版本更新
- iOS开发 检测版本更新的实现
- iOS开发之检测APP升级的实现
- Android检测版本更升级
- aq-Android版本检测升级
- Android版本检测更新升级
- iOS ——版本更新检测 判断应用版本和升级提示
- IOS 版本升级思路
- IOS 版本升级提示
- iOS APP升级版本
- gis外包团队承接各类GIS项目 qq:1352137742
- 关于static变量
- jquery遍历之parent()与parents()的区别 及 parentsUntil() 方法
- 内存的堆分配和栈分配
- MySql中的数据类型
- IOS 开发检测版本升级
- 如何为运行在SAP的SQL Server计划性能
- js 右键菜单、禁止剪切、复制、粘贴的文本框代码
- 实现数组反转
- 在 Visual C++ 中以错误的顺序链接 CRT 库和 MFC 库时出现 LNK2005 错误
- 数字证书的原理
- LeetCode:Subsets I
- .NET中的范型
- delete from和truncate table的区别