跳到APPStore

2017-02-10 14:32
271

if (btn.tag == 1) {        

//第一种方法  直接跳转       

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id1018221712"]];    }else{       

 //第二中方法  应用内跳转       

//1:导入StoreKit.framework,控制器里面添加框架#import//2:实现代理SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];

storeProductViewContorller.delegate = self;

//        ViewController *viewc = [[ViewController alloc]init];

//        __weak typeof(viewc) weakViewController = viewc;

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

[storeProductViewContorller loadProductWithParameters:

//appId

@{SKStoreProductParameterITunesItemIdentifier : @"1018221712"} completionBlock:^(BOOL result, NSError *error) {

//回调

if(error){

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

}else{

//AS应用界面

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

}

}];

}

帖子评论

关注 / 粉丝

我无话可说