美文网首页
App跳转到App Store

App跳转到App Store

作者: 蕤絮 | 来源:发表于2017-08-02 11:11 被阅读0次

    1.直接跳转到 App Store 

    1.进入appstore中指定的应用

    NSString *str = [NSString stringWithFormat:

    @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa /wa/viewContentsUserReviews?type=Purple+Software&id=%d",

    myAppID ];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

    其中myAppID为itunesconnect中的应用程序id

    2.进入首页

    NSString *str = [NSString stringWithFormat:

    @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%@",

    m_myAppID ];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

    2.在应用内打开

    //设置代理请求为当前控制器本身

    SKStoreProductViewController*storeProductViewContorller = [[SKStoreProductViewControlleralloc] init];

    //加载一个新的视图展示

    storeProductViewContorller.delegate =self;

    //appId唯一的

    [storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"1049660516"} completionBlock:^(BOOLresult,NSError*error) {//block回调

    if(error){

    NSLog(@"error %@ with userInfo %@",error,[error userInfo]);   

     }else{//模态弹出

    appstore[selfpresentViewController:storeProductViewContorller animated:YEScompletion:^{        }     

         ];    

    } }]

    //取消按钮监听

    - (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController{    [selfdismissViewControllerAnimated:YEScompletion:^{    }];

    }

    3.跳转到评论

    NSString *appstoreUrlString = [NSString stringWithFormat:

    @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@",

    m_appleID ];

    NSURL * url = [NSURL URLWithString:appstoreUrlString];

    if ([[UIApplication sharedApplication] canOpenURL:url]){

    [[UIApplication sharedApplication]openURL:url];

    }else {

    NSLog(@"can not open");

    }

    相关文章

      网友评论

          本文标题:App跳转到App Store

          本文链接:https://www.haomeiwen.com/subject/zjyelxtx.html