1、#import <StoreKit/StoreKit.h>
2、SKStoreProductViewControllerDelegate
3、
//首先实例化一个VC
SKStoreProductViewController storeVC = [[SKStoreProductViewController alloc] init];
//然后设置代理,注意这很重要,不如弹出就没法dismiss了
storeVC.delegate = self;
//接着弹出VC
[self presentViewController:storeVC animated:YES completion:nil];
//最后加载应用数据
[storeVC loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@(1382195436)} completionBlock:^(BOOL result, NSError _Nullable error) {
if (error) {
//handle the error
}
}];
4、
(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
//在代理方法里dismiss这个VC
[viewController dismissViewControllerAnimated:YES completion:nil];
}
0 个回复