标签:boa bool eve ict little nat let versions ase
代码:
#import <StoreKit/StoreKit.h> @interface CustomVC ()<SKStoreProductViewControllerDelegate> { SKStoreProductViewController *_storeVC ; } @end @implementation CustomVC - (void)viewDidLoad { [super viewDidLoad]; } #pragma mark SKStoreProductViewControllerDelegate /**storeVC消失的时候调用的方法*/ - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController __TVOS_PROHIBITED NS_AVAILABLE_IOS(6_0){ NSLog(@"---------------------------------------"); [_storeVC dismissViewControllerAnimated:YES completion:nil]; } -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ _storeVC = [SKStoreProductViewController new]; _storeVC.delegate = self; // storeVC.view.frame = self.view.frame; // [self.view addSubview:storeVC.view]; if (@available(iOS 11.0, *)) { NSDictionary *parame = @{SKStoreProductParameterITunesItemIdentifier:@"1467094391"}; [_storeVC loadProductWithParameters:parame completionBlock:^(BOOL result, NSError * _Nullable error) { //加载成功 NSLog(@"---------------------------------------%d:%@",result,error); }]; } else { // Fallback on earlier versions } [self.navigationController presentViewController:_storeVC animated:YES completion:nil]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end
SKStoreProductViewController的使用,我们想看app的信息或者下载,又不想跳转appstore的方法
标签:boa bool eve ict little nat let versions ase
原文地址:https://www.cnblogs.com/hualuoshuijia/p/11493007.html