iOS app内评分

 

app内评分

  导入依赖的框架

  #import <StoreKit/StoreKit.h>

 

  

// app内评分
- (void)presentStoreProductVC
{
    
    SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
    
    storeProductViewContorller.delegate = self;
    
    [storeProductViewContorller loadProductWithParameters:
     
     @{SKStoreProductParameterITunesItemIdentifier:@"xxxxxxxxx"} completionBlock:^(BOOL result, NSError *error) {
         
         if(error){
             NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
         }else{
             
             [self presentViewController:storeProductViewContorller animated:YES completion:nil];
         }
     }];
}

#pragma mark - SKStoreProductViewControllerDelegate
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

 

  

posted on 2015-05-15 16:55  airy99  阅读(213)  评论(0编辑  收藏  举报