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]; }
时间: 2024-11-05 19:06:07