iOS知识点iOS Developer

App跳转到APPStore

2017-02-09  本文已影响62人  老骚鹅

http://www.jianshu.com/p/25fb79fb2e5f

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];

}

}];

}

上一篇下一篇

猜你喜欢

热点阅读