iOS应用内跳转到appstore里评分

1、跳到appstore评分

https://itunes.apple.com/cn/app/%E4%BA%AC%E4%B8%9C-%E9%A6%96%E6%AC%A1%E8%B4%AD%E4%B9%B0%E5%8F%AF%E9%A2%86%E5%8F%96188%E5%85%83%E4%BC%98%E6%83%A0%E5%88%B8/id414245413?mt=8

以上网址是京东在appstore上的app地址,京东的APPID=414245413

1.1 方案一

跳出应用,跳转到AppStore,进行评分

NSString *urlStr = [NSString stringWithFormat:@”itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@&pageNumber=0&sortOrdering=2&mt=8″, APPID];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];

1.2 方案二

苹果提供了一个框架StoreKit.framework,导入StoreKit.framework,在需要跳转的控制器里面添加头文件#import, 实现代理方法:< SKStorePRoductViewControllerDelegate >

– (void)loadAppStoreController

{

// 初始化控制器

SKStoreProductViewController*storeProductViewContorller = [[SKStoreProductViewController alloc]init];

// 设置代理请求为当前控制器本身

storeProductViewContorller.delegate=self;

[storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:APPID}completionBlock:^(BOOL result,NSError*error)   {

if(error)  {

NSLog(@”error %@ with userInfo %@”,error,[error userInfo]);

}else{

// 模态弹出appstore

[self presentViewController:storeProductViewContorller animated:YES completion:nil];

}

}];

}

//AppStore取消按钮监听

– (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController

{

[self dismissViewControllerAnimated:YES completion:nil];

}

2、跳转到应用详情

NSString *urlStr = [NSString stringWithFormat:@”itms-apps://itunes.apple.com/app/id%@”, APPID];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注