iOS应用内部跳转AppStore

  • 该方法是iOS 6.0之后加入
    1、首先导入需要的框架,StoreKit.framework
    2、导入头文件#import
SKStoreProductViewController *storeProductVC = [[SKStoreProductViewController alloc]init];
    storeProductVC.delegate = self;
    [storeProductVC loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"977974699"} completionBlock:^(BOOL result, NSError * _Nullable error) {
        
        if (error) {
            NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
        }
        else {
            [self presentViewController:storeProductVC animated:YES completion:^{
                
            }];
        }
        
    }];

#pragma mark - SKStoreProductViewControllerDelegate

- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];

}

你可能感兴趣的:(iOS应用内部跳转AppStore)