APP評(píng)分實(shí)現(xiàn)有兩種方式:跳轉(zhuǎn)到App Store進(jìn)行評(píng)分和APP內(nèi)評(píng)分
1.跳轉(zhuǎn)到App Store進(jìn)行評(píng)分
ps:appid可在iTunes connect里面查詢
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=APPID&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8"]];
2.在自己app內(nèi),內(nèi)置App Store評(píng)分。蘋果提供了一個(gè)框架StoreKit.framework,導(dǎo)入StoreKit.framework,在需要跳轉(zhuǎn)的控制器里面添加頭文件#import, 實(shí)現(xiàn)代理方法:< SKStorePRoductViewControllerDelegate >
//加載App Store評(píng)分控制器
- (void)setUpAppStoreController
{
// 初始化控制器
SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
// 設(shè)置代理請(qǐng)求為當(dāng)前控制器本身
storeProductViewContorller.delegate = self;
[storeProductViewContorller loadProductWithParameters: @{SKStoreProductParameterITunesItemIdentifier: kAppId} completionBlock:^(BOOLresult,NSError*error) {
if(error) {
NSLog(@"error %@ with userInfo %@",error,[erroruserInfo]);
}else{
// 模態(tài)彈出App Store評(píng)分控制器
[self presentViewController:storeProductViewContorller animated:YEScompletion:nil];
}
}];
}
//監(jiān)聽App Store取消按鈕點(diǎn)擊
- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController
{
[self dismissViewControllerAnimated: YES completion: nil];
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。