完成该功能需要使用SKStoreProductViewController,只支持iOS 6,直接看代码吧。
if(NSClassFromString(@"SKStoreProductViewController")) { // Checks for iOS 6 feature.
SKStoreProductViewController *storeController = [[SKStoreProductViewController alloc] init];
storeController.delegate = delegate; // productViewControllerDidFinish
NSDictionary *productParameters = @{ SKStoreProductParameterITunesItemIdentifier : appID};
[storeController loadProductWithParameters:productParameters completionBlock:nil];
[controller presentViewController:storeController animated:YES completion:nil];
}
else { // Before iOS 6, we can only open the URL
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
还需要实现一个代理方法- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[viewController dismissModalViewControllerAnimated:YES];
}
如果直接跳转某个app的评论,可使用如下地址(把xxx替换为正确的app id即可)
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=xxx