Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [BaseService postJSONWithUrl:APP_URL parameters:nil success:^(id responseObject)
- {
- NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil removingNulls:YES ignoreArrays:NO];
- NSArray *infoArray = [dic objectForKey:@"results"];
- if ([infoArray count])
- {
- NSDictionary *releaseInfo = [infoArray objectAtIndex:0];
- NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
- NSString *currentVersion = [[infoDic objectForKey:@"CFBundleShortVersionString"] stringByReplacingOccurrencesOfString:@"." withString:@""];
- NSString *lastVersion = [[releaseInfo objectForKey:@"version"] stringByReplacingOccurrencesOfString:@"." withString:@""];
- CGFloat fLast = [lastVersion intValue] > 100 ? [lastVersion intValue] : [lastVersion intValue]*10;
- CGFloat fCurrent = [currentVersion intValue] > 100 ? [currentVersion intValue] : [currentVersion intValue]*10;
- if (fLast>fCurrent)
- {
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"更新" message:@"有新的版本更新,是否前往更新?" delegate:__self cancelButtonTitle:@"关闭" otherButtonTitles:@"更新", nil];
- alert.tag = 100;
- [alert show];
- }
- }
- } fail:^(NSError *error)
- {
- DLog(@"获取失败");
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement