iOS應用內整合AppStore評分功能

來源:互聯網
上載者:User

標籤:error   dex   ios   三次   webapps   使用   .com   UI   網頁   

iOS應用內部實現App Store評分功能,筆著整理總結有三種方式,各位可根據自己需求自己選擇。先介紹下評分功能實現的三種方式。

1,通用方式通過App內部開啟網頁形式,跳轉到AppStore編輯評論,可評分,可評論。

優點:方便,快捷,不受系統版本限制,目前最常用的方式。

缺點:內部網頁形式載入緩慢,等待時間長,載入失敗機率大。

2,iOS 6.0以後 在app內部載入AppStore 展示app資訊

優點:展示速度比方法三塊快

缺點:不能直接跳轉到評論編輯頁面,需要手動點擊評論+編輯評論

3,iOS 10.0.3 新增應用內評分功能,調用系統方法評分。

優點:無須跳轉,應用內系統彈框,方便快速。

缺點:只能評分,且一年只能使用三次彈框。

開發步驟:

匯入標頭檔 #import

1,iOS 10.0.3以後調用系統彈框評分

123456789101112 /** * 只能評分,不能編寫評論 * 有次數限制,一年只能使用三次 * 使用次數超限後,需要跳轉appstore */- (IBAction)systemComentBtnAction:(UIButton *)sender {if([SKStoreReviewController respondsToSelector:@selector(requestReview)]) {// iOS 10.3 以上支援    //防止鍵盤遮擋    [[UIApplication sharedApplication].keyWindow endEditing:YES];    [SKStoreReviewController requestReview];}

2,跳轉到AppStore對應應用評論頁面

1234567 /** * 可評分評論,無次數限制 */- (IBAction)appStoreComentBtnAction:(UIButton *)sender {NSString  * nsStringToOpen = [NSString  stringWithFormat: @"itms-apps://itunes.apple.com/app/id%@?action=write-review",@"AppID"];//替換為對應的APPID[[UIApplication sharedApplication] openURL:[NSURL URLWithString:nsStringToOpen]];}

3,iOS 6.0以後的方法,內部載入AppStore

 

註:需簽署代理

1234567891011121314151617181920212223242526272829303132 /** * 在APP內部載入App Store 展示APP資訊,但不能直接跳轉到評論編輯頁面。 * 再載入處App Store展示頁面後,需要手動點擊 評論→ 撰寫評論 */- (IBAction)webAppStoreBtnAction:(UIButton *)sender {SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];storeProductViewContorller.delegate = self;//載入App Store視圖展示[storeProductViewContorller loadProductWithParameters:   @{SKStoreProductParameterITunesItemIdentifier : @"APPID"} completionBlock:^(BOOL result, NSError *error) {           if(error) {               else {                   //模態彈出appstore                   [self presentViewController:storeProductViewContorller animated:YES completion:^{                       }];               }       }];}// 代理方法- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {[self dismissViewControllerAnimated:YES completion:^{     }];}

iOS應用內整合AppStore評分功能

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.