1. 程式人生 > >跳轉到AppStore某個應用詳情頁面

跳轉到AppStore某個應用詳情頁面

1. 獲取應用的連結地址

開啟iTunes,搜尋應用的名稱,點選倒三角按鈕,選擇拷貝連結

2. 跳轉

1、iOS原生應用跳轉:(通過AppStore App,推薦使用)

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"app的連結"]];

2、html5應用跳轉, 這裡分為兩種方式。一種直接寫個\ 標籤,一種是利用js

<a href="itms-apps://itunes.apple.com/cn/app/jie-zou-da-shi/id493901993?mt=8">更新</a
>
window.open('itms-apps://itunes.apple.com/cn/app/jie-zou-da-shi/id493901993?mt=8');

3.應用內直接跳轉到appstore,需要新增StoreKit,framework系統庫,需要實現下面的代理方法

SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewControlleralloc] init];
//設定代理請求為當前控制器本身
storeProductViewContorller.delegate
= self; //載入一個新的檢視展示 [storeProductViewContorller loadProductWithParameters: //appId唯一的 @{SKStoreProductParameterITunesItemIdentifier : @"1049660516"} completionBlock:^(BOOL result, NSError *error) { //block回撥 if(error){ NSLog(@"error %@ with userInfo %@",error,[error userInfo]); }else
{ //模態彈出appstore [self presentViewController:storeProductViewContorller animated:YES completion:^{ } ]; } }] //取消按鈕監聽 - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{ [self dismissViewControllerAnimated:YES completion:^{ }]; }

2016/11/17
補充:跳轉到評價頁面:

int appID = 1118301512;
    NSString *str = [NSString stringWithFormat:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%d&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8",appID];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];