#pragma mark - 获取 AppStore 版本号
+ (void)fetchAppStoreVersion:(void (^)(NSString *appStoreVersion))version {
NSString *urlString = @"http://itunes.apple.com/lookup?id=1123497532";
[LBHTTPTool postDataSourceWithUrl:urlString params:nil contentType:@"text/javascript" success:^(id responseObject) {
NSString *appStoreVersion = [responseObject[@"results"] lastObject][@"version"];
version(appStoreVersion);
} failure:^(NSError *error) {
NSLog(@"%@", error);
}];
}
#pragma mark - 获取当前安装版本号
+ (NSString *)fetchCurrentInstalledVersion {
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
}
#pragma mark - 跳转到 AppStore 下载
+ (void)skipToAppStore {
NSString *urlString = @"itms-apps://itunes.apple.com/app/id1123497532";
id 为应用的appid
NSURL *url = [NSURL URLWithString:urlString];
[[UIApplication sharedApplication] openURL:url];
}