赞
踩
1、首先设置网络访问http
2、进行AppStore应用评分需要设置地址格式:
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID
APP_ID为itunesConnect里面应用程序的Apple ID。
第一种方式:
跳转AppStore进行应用评分代码如下:
NSString *evaluateString = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@",APP_ID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:evaluateString]];
注意:使用真机测试,模拟器会报错误:
LaunchServices: ERROR: There is no registered handler for URL scheme itms-apps
第二种方法:
添加StoreKit.framework
导入#import
//方法二
//初始化控制器
SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
//设置代理请求为当前控制器本身
storeProductViewContorller.delegate = self;
//加载一个新的视图展示
[storeProductViewContorller loadProductWithParameters:
//appId唯一的
@{SKStoreProductParameterITunesItemIdentifier : APP_ID} completionBlock:^(BOOL result, NSError *error) {
//block回调
if(error){
NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
}else{
//模态弹出appstore
[self presentViewController:storeProductViewContorller animated:YES completion:^{
}
];
}
}];

代理事件
#pragma mark-SKStoreProductViewControllerDelegate
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{
[self dismissViewControllerAnimated:YES completion:^{
}];
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。