iOS APP評分方式

1.跳出應(yīng)用,跳轉(zhuǎn)到AppStore,進(jìn)行評分


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

NSString *str = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=xxxxxx" ]; ?

[[UIapplication sharedApplication] openURL:[NSURL URLWithString:str]]; ?

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

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

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


2.在應(yīng)用內(nèi),內(nèi)置AppStore進(jìn)行評分

蘋果提供了一個框架StoreKit.framework,導(dǎo)入StoreKit.framework,在需要跳轉(zhuǎn)的控制器里面添加頭文件 #import, 實(shí)現(xiàn)代理方法:< SKStorePRoductViewControllerDelegate >

//自定義方法

- (void)loadAppStoreController

{

// 初始化控制器

SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];

// 設(shè)置代理請求為當(dāng)前控制器本身

storeProductViewContorller.delegate = self;

[storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:kAppId} ?completionBlock:^(BOOL result, NSError *error) ? {

if(error)

{

NSLog(@"error %@ with userInfo %@",error,[error userInfo]);

} ?else

{

// 模態(tài)彈出appstore

[self presentViewController:storeProductViewContorller animated:YES completion:^{

}];

}

//AppStore取消按鈕監(jiān)聽

- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController

{

[self dismissViewControllerAnimated:YES completion:^{

}];

}

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

相關(guān)閱讀更多精彩內(nèi)容

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