美文网首页
2019-05-14 获取App S

2019-05-14 获取App S

作者: 法库德 | 来源:发表于2019-05-14 15:03 被阅读0次

获取App Store上的版本号

////获取App Store版本

-(NSString*)getAPPstoreInfo{

    NSString*appID=@"1454501914";

    NSString *urlStr=[NSString stringWithFormat:@"https://itunes.apple.com/cn/lookup?id=%@",appID];

    NSURL*url=[NSURLURLWithString:urlStr];

    NSData*json = [NSDatadataWithContentsOfURL:url];

    NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:json options:kNilOptions error:NULL];//解析json文件

    NSArray*results = [dictobjectForKey:@"results"];

    NSDictionary*result = [resultsobjectAtIndex:0];

    NSString*versionStr = [resultobjectForKey:@"version"];//获得AppStore中的app的版本

returnversionStr?versionStr:@"0";

}

相关文章

网友评论

      本文标题:2019-05-14 获取App S

      本文链接:https://www.haomeiwen.com/subject/ycisaqtx.html