zoukankan      html  css  js  c++  java
  • 更新版本

    -(void)xinban{

        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];

        NSString *string=@"apikey";

        [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=%@",string]]];

        [request setHTTPMethod:@"GET"];

        NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

        NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:returnData options:0 error:nil];

        

        NSArray *arry=[jsonData objectForKey:@"results"];

        NSString *appstrorebanben=[[arry objectAtIndex:0] objectForKey:@"version"];

        

        self.trackViewUrl1= [[arry objectAtIndex:0] objectForKey:@"trackViewUrl"];//地址trackViewUrl

        NSUserDefaults * setting = [NSUserDefaults standardUserDefaults];

        

        if (![[setting objectForKey:@"appstrore"] isEqualToString:appstrorebanben]) {

            NSDictionary* dict = [[NSBundle mainBundle] infoDictionary];

            NSString  *currntbanben=[dict objectForKey:@"CFBundleVersion"];

            

            if (![currntbanben isEqualToString:appstrorebanben] ) {

                UIAlertView* view = [[UIAlertView alloc] initWithTitle:@"提示" message:@"啊哦,发现有新版本哦,赶快升级吧!" delegate:self cancelButtonTitle:@"先不要啦" otherButtonTitles:@"立即升级", nil];

                [view show];

                [setting setObject:appstrorebanben forKey:@"appstrore"];

            }

        }

    }

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

        if (buttonIndex == 1) {

            // 弹出AppStore更新界面

            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",self.trackViewUrl1]]];

        }

    }

  • 相关阅读:
    C#中Cookies操作
    获取WPF url 地址中的Cookies
    c#的dllimport使用方法详解
    SQLite的原子提交及WAL日志模式 和 SQLite多线程解决方案
    单例模式
    C# 操作 ofd 文件
    .NET Core 3 、WPF MVVM框架 、Prism系列 之经典 博客园友
    .NET Core 3 WPF MVVM框架 Prism系列之事件聚合器
    程序员不得不了解的硬核知识大全
    Invalid prop: custom validator check failed for prop "pagination".
  • 原文地址:https://www.cnblogs.com/106dapeng/p/4683307.html
Copyright © 2011-2022 走看看