zoukankan      html  css  js  c++  java
  • 根据appid跳到App Store某个APP的详情页

    需求

    本手机是否装了某个APP 示例百度appid 382201985  scheme BaiduSSO://

    1.是,直接打开百度APP

    2.否,跳到App Store百度APP的详情页

    NSString *aScheme = @"BaiduSSO://";

        NSString *aAppleId = @"382201985";

        NSURL*aAppUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@://", aScheme]];

    //打开某个APP

        [[UIApplication sharedApplication] openURL:aAppUrl options:@{} completionHandler:^(BOOL success) {

            if (!success) {

    //跳到App Store某个APP的详情页

               [self showAppStoreWithAppId:aAppleId];

            }

        }];

    导入头文件 

    #import <StoreKit/StoreKit.h>

    加代理

    SKStoreProductViewControllerDelegate

     

    -(void)showAppStoreWithAppId:(NSString *)appId

    {

        SKStoreProductViewController *appStore = [[SKStoreProductViewController alloc] init];

        appStore.delegate = self;

        [appStore loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:appId} completionBlock:^(BOOL result, NSError * _Nullable error) {

            if (error) {

                NSLog(@"错误 %@",error);

            } else {

            }

        }];

        [self presentViewController:appStore animated:YES completion:nil];

    }

    - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController

    {

        [viewController dismissViewControllerAnimated:YES completion:nil];

    }

  • 相关阅读:
    Struts2+Spring+Ibatis集成合并
    spring多个定时任务quartz配置
    Quartz作业调度框架
    百度搜索URL参数含义
    代理IP抓取
    解决HttpWebRequest和HtmlAgilityPack采集网页中文乱码问题
    移动端上传头像-相册、拍摄-旋转
    订单倒计时
    css flex布局 实例
    currentTarget与target
  • 原文地址:https://www.cnblogs.com/huangzs/p/13533412.html
Copyright © 2011-2022 走看看