ios App内部弹出AppStore下载界面

1,导入#import
2,遵守SKStoreProductViewControllerDelegate协议
3,使用如下代码 其中900089067为app在App Store中的id号
SKStoreProductViewController *store = [[SKStoreProductViewController alloc] init];
store.delegate = self;
NSDictionary *dic = [NSDictionary dictionaryWithObject:@"900089067" forKey:SKStoreProductParameterITunesItemIdentifier];
[store loadProductWithParameters:dic completionBlock:^(BOOL result, NSError * _Nullable error) {
if (!error) {
[self presentViewController:store animated:YES completion:nil];
}
else {
NSLog(@"ERROR:%@", error);
}
}];
4实现代理

  • (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{
    [viewController dismissViewControllerAnimated:YES completion:nil];
    }
    完美成功

你可能感兴趣的:(ios App内部弹出AppStore下载界面)