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, 實現(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:^{
}];
}