iOS 提示用户升级版本

一、问题:自己做提示用户升级?

由于苹果做了自动升级,所有只要在应用程序中出现从AppStore检查版本更新,或者出现任何有关升级的提醒都会被拒但是如果必须添加升级提示的话,可以配合后台通过添加API的方式来做,就是版本信息存储在服务器,应用只需要请求数据,拿到数据版本然后和当前的版本比较就可以了,由于是从服务器拿数据,所以在审核期间,让后台控制版本,不提示升级问题,审核通过之后,更改服务器版本到最新版就可以了

跳转到appstore 如下:

            [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/cn/app/id1288515707"]];

//拿服务器的版本与当前的比较
// 获取当前版本
-(NSString *)version
{
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *app_Version       = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    return app_Version;
}


二、id1288515707 这个id 如何获取如下:

登录苹果开发者账号 --> 登录账号--> 点击iTunes Connect --> go to iTunes Connect --> My App (我的App) --> 点击App Store 栏下的 APP 信息 --> 向下滑会看到 Apple ID 这个就是跳转到应用程序需要的id






三、从AppStore检查版本更新,一定不要去做,上线提交的时候一定会被拒的

NSString *url = [[NSString alloc] initWithFormat:@"http://itunes.apple.com/lookup?id=%@",id]; // id就是线上产品的ID

NSURL *url = [NSURL URLWithString:path];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
                                                           cachePolicy:NSURLRequestReloadIgnoringCacheData
                                                       timeoutInterval:10];
    [request setHTTPMethod:@"POST"];
    NSOperationQueue *queue = [NSOperationQueue new];

    [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response,NSData *data,NSError *error){
        receiveStatusDic=[[NSMutableDictionary alloc]init];
        if (data) {
            NSDictionary *receiveDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
            NSLog(@"receiveDic is %@",receiveDic); //字典receiveDic中就包含版本信息
        }
 信息入下 
{  
    resultCount = 1;  
    receiveDic =     (  
                {  
            artistId = 开发者 ID;  
            artistName = 开发者名称; 
            price = 0; 
            isGameCenterEnabled = 0;  
            kind = software;  
            languageCodesISO2A =             (  
                EN  
            ); 
            trackCensoredName = 审查名称;  
            trackContentRating = 评级;  
            trackId = 应用程序 ID;  
            trackName = 应用程序名称";  
            trackViewUrl = 应用程序介绍网址;  
            userRatingCount = 用户评级;  
            userRatingCountForCurrentVersion = 1;  
            version = 版本号;  
            wrapperType = software; 
      }  
    );  
}



猜你喜欢

转载自www.cnblogs.com/junhuawang/p/9050657.html