iOS開發(fā)--跳轉(zhuǎn)AppStore點(diǎn)贊評(píng)

iOS開發(fā)利用"SKStoreProductViewController"跳轉(zhuǎn)AppStore點(diǎn)贊評(píng)

大家都知道,評(píng)論評(píng)分是決定appappstore中排名的重要因素,但是大部分用戶下載安裝APP后卻不會(huì)去點(diǎn)評(píng),所以添加提示用戶去點(diǎn)評(píng)的功能是很必要的。

目前,AppStore點(diǎn)贊評(píng)分有兩種方法,一種是跳出應(yīng)用,跳轉(zhuǎn)到AppStore;進(jìn)行評(píng)分.另一種是在應(yīng)用里內(nèi)置AppStore進(jìn)行評(píng)分.

序號(hào) 方法 備注
in:在應(yīng)用里內(nèi)置AppStore進(jìn)行評(píng)分 利用系統(tǒng)類:SKStoreProductViewController
out:跳出應(yīng)用,跳轉(zhuǎn)到AppStore,進(jìn)行評(píng)分 利用方法:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]

方法一:在應(yīng)用內(nèi),內(nèi)置AppStore進(jìn)行評(píng)分

1、添加依賴 #import<StoreKit/StoreKit.h>
2、添加代理 <SKStoreProductViewControllerDelegate>
3、添加代碼:調(diào)用跳轉(zhuǎn)方法 [self thumbsUpWithAppStore];

- (void)thumbsUpWithAppStore {
   SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init]; 
//設(shè)置代理請(qǐng)求為當(dāng)前控制器本身
   storeProductViewContorller.delegate = self; //加載一個(gè)新的視圖展示
   [storeProductViewContorller loadProductWithParameters: //appId唯一的         
   [SKStoreProductParameterITunesItemIdentifier : @"自己平臺(tái)的appid"} completionBlock:^(BOOL result, NSError *error) { //block回調(diào)
          if(error){
               NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
           }else{ //模態(tài)彈出appstore
              [self presentViewController:storeProductViewContorller animated:YES completion:^{                  
              }];
            }
    }];
  }

遵循代理SKStoreProductViewControllerDelegate:取消按鈕監(jiān)聽

- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{
    [self dismissViewControllerAnimated:YES completion:^{
    }];
}

注意:appId是唯一的,
appleIDhttps://itunesconnect.apple.com 中創(chuàng)建應(yīng)用即可在應(yīng)用界面獲得
即不同的app不同的appid,請(qǐng)用自己工程的appid。

**注意: **
這個(gè)appIDitunes connect里面你提交app 時(shí)候自動(dòng)生成的,是apple的唯一的ID。方法二中:將appid鏈接中將xxxxxxx替換為自己應(yīng)用appid。

方法二:跳出應(yīng)用,跳轉(zhuǎn)到AppStore,進(jìn)行評(píng)分

App Store上評(píng)論的鏈接地址有種,分為iOS7前后鏈接:

分類 鏈接 說明
iOS7鏈接 itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id = xxxxxxxx 其中xxxxxxxx為自己app的aped
iOS7鏈接 itms-apps://itunes.apple.com/app/idxxxxxxxxx 其中xxxxxxxx為自己appappid
代碼:
-(void)goToAppStore
{    
如果是7.0以前的系統(tǒng)
    NSString *str = [NSString stringWithFormat: @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d",547203890];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];   

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];  

如果是7.0以后的系統(tǒng)

NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id547203890"];  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];  
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容