1、應(yīng)用內(nèi)部跳轉(zhuǎn)到Appstore
- 跳轉(zhuǎn)到應(yīng)用詳情
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id1061880281"]];
其中 @"itms-apps://itunes.apple.com/app/id1061880281"為拼接地址,1061880281為應(yīng)用在Appstore注冊(cè)上線時(shí)產(chǎn)生的唯一ID
- 跳轉(zhuǎn)到評(píng)論
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1232138855&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8"]];
注:由于iOS11對(duì)應(yīng)用商店進(jìn)行了重新設(shè)計(jì),使用該鏈接在iOS11系統(tǒng)上會(huì)發(fā)現(xiàn)找不到應(yīng)用。解決辦法:判斷系統(tǒng)版本,如果系統(tǒng)版本大于iOS11,跳轉(zhuǎn)上1鏈接即可
2、掃描二維碼跳轉(zhuǎn)到appstore
- https://itunes.apple.com/app/id1061880281 ,用這個(gè)地址生成二維碼即可
但是有可能會(huì)碰到多國(guó)語言問題,你會(huì)發(fā)現(xiàn)在其他語言下用安卓設(shè)備掃描二維碼會(huì)進(jìn)入itunes,而默認(rèn)展示出來的界面確是英文環(huán)境,這是你只需要在 https://itunes.apple.com/app/id1061880281 修改為如下:
例如中文:https://itunes.apple.com/cn/app/id1061880281
例如日文:https://itunes.apple.com/jp/app/id1061880281
等等...也就是在https://itunes.apple.com/后面加上國(guó)家的簡(jiǎn)寫國(guó)際字符即可
3、檢測(cè)新版本升級(jí)跳轉(zhuǎn)到AppStore
注:這個(gè)功能只有寫在應(yīng)用每次啟動(dòng)時(shí)檢測(cè),如果在設(shè)置界面留有檢測(cè)更新入口,上架時(shí)審核會(huì)被蘋果拒絕,蘋果是不允許在AppStore之外的方式升級(jí)的
-(void)checkVersion {
NSString *path = [[NSString alloc] initWithFormat:@"http://itunes.apple.com/lookup?id=%@",@"1061880281"];
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){
NSMutableDictionary *receiveStatusDic=[[NSMutableDictionary alloc]init];
if (data) {
NSDictionary *receiveDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
if ([[receiveDic valueForKey:@"resultCount"] intValue]>0) {
[receiveStatusDic setValue:@"1" forKey:@"status"];
[receiveStatusDic setValue:[[[receiveDic valueForKey:@"results"] objectAtIndex:0] valueForKey:@"version"] forKey:@"version"];
}else{
[receiveStatusDic setValue:@"-1" forKey:@"status"];
}
}else{
[receiveStatusDic setValue:@"-1" forKey:@"status"];
}
[self performSelectorOnMainThread:@selector(receiveData:) withObject:receiveStatusDic waitUntilDone:NO];
}];
}
- (void)receiveData:(id)sender {
NSString *serverVersion = [sender objectForKey:@"version"]; //獲取版本號(hào)
//獲取應(yīng)用當(dāng)前版本
NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
// 服務(wù)器版本號(hào)大于當(dāng)前版本號(hào)
if ([serverVersion compare:currentVersion options:NSNumericSearch] == NSOrderedDescending) {
// 有新版本,執(zhí)行升級(jí)操作
} else {
// 沒有檢測(cè)到新版本
}
}