//赞一个
- (void)thumbsUpWithAppStore
{
SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
//设置代理请求为当前控制器本身
storeProductViewContorller.delegate = self;
//加载一个新的视图展示
[storeProductViewContorller loadProductWithParameters:
//appId唯一的 @{SKStoreProductParameterITunesItemIdentifier : @"587767923"} completionBlock:^(BOOL result, NSError *error) {
//block回调
if(error){
NSLog(@"error %@ with userInfo %@",error,[error userInfo]);
}else{
//模态弹出appstore
[self presentViewController:storeProductViewContorller animated:YES completion:^{
}
];
}
}];
}
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController{
[self dismissViewControllerAnimated:YES completion:^{
}];
}
方法二:跳出应用,跳转到AppStore,进行评分
App Store
上评论的链接地址有二
种,分为iOS7
前后链接:
分类 | 链接 | 说明 |
iOS7 之前 链接 |
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id = xxxxxxxx |
其中xxxxxxxx 为自己app的aped |
iOS7 之后 链接 |
itms-apps://itunes.apple.com/app/idxxxxxxxxx |
其中xxxxxxxx 为自己app 的appid |
代码:
-(void)goToAppStore
{
如果是7.0以前的系统
NSString *str = [NSString stringWithFormat:
@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d",547203890];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
如果是7.0以后的系统
NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id547203890"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
**注意: **
这个appID
是itunes connect
里面你提交app
时候自动生成的,是apple
的唯一的ID
。方法二中:将appid
链接中将xxxxxxx
替换为54720389
。