当前位置:   article > 正文

iOS应用打开AppStore页面_ios app内打开商店页

ios app内打开商店页

【1】应用内跳转到App Store页

使用官方 StoreKit.framework 框架

  1. #import <StoreKit/StoreKit.h>
  2. - (void)OnButtonClick {
  3. NSDictionary *dict = [NSDictionary dictionaryWithObject:@"440948110" forKey:SKStoreProductParameterITunesItemIdentifier];
  4. SKStoreProductViewController *ctrl = [[SKStoreProductViewController alloc] init];
  5. ctrl.delegate = self;
  6. [ctrl loadProductWithParameters:dict completionBlock:^(BOOL result, NSError * _Nullable error) {
  7. if(error) {
  8. NSLog(@"Error:%@",error.userInfo);
  9. }
  10. else {
  11. [self presentViewController:ctrl animated:YES completion:nil];
  12. }
  13. }];
  14. }
  15. #pragma mark - SKStoreProductViewControllerDelegate
  16. - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
  17. [viewController dismissViewControllerAnimated:YES completion:^{
  18. NSLog(@"productViewControllerDidFinish");
  19. }];
  20. }

【2】跳转到App Store应用的URL

  1. NSString *urlstr = @"https://itunes.apple.com/app/apple-store/id440948110?mt=8";
  2. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlstr]];

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/420996?site
推荐阅读
相关标签
  

闽ICP备14008679号