方法一:直接跳到商店
NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id1071190903"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
方法二:加载一个商店控制器
//自定义方法
- (void)loadAppStoreController {
// 初始化控制器
SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
// 设置代理请求为当前控制器本身
storeProductViewContorller.delegate = self;
[storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"1071190903"} completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
}else {
// 模态弹出appstore
[self presentViewController:storeProductViewContorller animated:YES completion:^{
}];
}
}];
}
//AppStore取消按钮监听
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[self dismissViewControllerAnimated:YES completion:^{
}];
}
iOS 转跳到 AppStore 为应用评分
最新推荐文章于 2019-04-28 09:53:55 发布