方法一:直接跳到商店
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 为应用评分
最新推荐文章于 2021-06-03 16:57:17 发布
本文介绍了两种在iOS应用中引导用户进入指定App Store页面的方法:一是通过直接调用URL方案实现;二是利用SKStoreProductViewController加载App Store控制器,并提供了具体的实现代码。

2729

被折叠的 条评论
为什么被折叠?



