美文网首页
iOS应用内部跳转AppStore

iOS应用内部跳转AppStore

作者: kenewang | 来源:发表于2016-11-16 18:07 被阅读3次
  • 该方法是iOS 6.0之后加入
    1、首先导入需要的框架,StoreKit.framework
    2、导入头文件#import <StoreKit/StoreKit.h>
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

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