美文网首页
ios App内部弹出AppStore下载界面

ios App内部弹出AppStore下载界面

作者: FM_0138 | 来源:发表于2019-04-11 10:17 被阅读0次

1,导入#import <StoreKit/StoreKit.h> 库
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下载界面

      本文链接:https://www.haomeiwen.com/subject/ktbziqtx.html