iOS 检查app版本更新操作

iOS 检查app版本更新操作

1:获取本地安装的版本信息:

[NSString stringWithFormat:@"Version %@ (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], kRevisionNumber]

2:根据appStore上的 appid查询 appStore上的版本信息:

  调用接口:http://itunes.apple.com/lookup?id=350962117   
  id 是app的  在appStore的id

  解析上述接口返回的信息:

 

iOS 检查app版本更新操作
"artworkUrl60":"http://a1059.phobos.apple.com/us/r30/Purple/v4/85/84/83/858483a3-bd90-c06c-7225-4cfe967b6fd2/icon.png",
"artworkUrl512":"http://a498.phobos.apple.com/us/r30/Purple6/v4/e4/7c/82/e47c824c-e442-5395-f586-3c9539e107d1/mzl.orbupbly.png",
"artistViewUrl":"https://itunes.apple.com/us/artist/sina-corporation-nasdaq-sina/id291478092?uo=4",
"artistId":291478092,
"artistName":"SINA Corporation (Nasdaq: SINA)",
"price":0,
"version":"4.2.0",
"description":"Sina Weibo is a "visual" micro-blogging service which cleverly integr
iOS 检查app版本更新操作

  version:对应的就是store上的最新的app版本;

3:发现新版本之后,调用 网址去更新

    NSURL * url = [NSURL URLWithString:itunesURL];

        [[UIApplication sharedApplicationopenURL:url];

 

4:推荐 https://github.com/nicklockwood/iVersion

参考:http://*.com/questions/458632/how-can-my-iphone-app-detect-its-own-version-number

iOS 检查app版本更新操作

上一篇:uniapp——点击图片放大预览


下一篇:3ds Max打造真实版梵高呐喊油画教程