需要用到的系统库
StoreKit.framework
控制器
SKStoreProductViewController -- 直达下载页
SKStoreReviewController -- 快捷评分iOS10.3 +
协议
<SKStoreProductViewControllerDelegate>
-
APP内部直达App Store
过往方式:
获取APP在应用商店的地址 例如:微信
[https://itunes.apple.com/cn/app/%E5%BE%AE%E4%BF%A1/id414478124?mt=8]
将http:// 或者 https:// 用itms://(itms-apps://)
[itms://itunes.apple.com/cn/app/%E5%BE%AE%E4%BF%A1/id414478124?mt=8]
调用如下代码
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.apple.com/cn/app/%E5%BE%AE%E4%BF%A1/id414478124?mt=8"]];
直达(iOS6 +):
导入头文件
import <StoreKit/StoreKit.h>
遵守协议<SKStoreProductViewControllerDelegate>
- (void)openAppWithIdentifier:(NSString*)appId{
SKStoreProductViewController*productViewController = [[SKStoreProductViewController alloc] init];
productViewController.delegate=self;
NSDictionary*dict = @{SKStoreProductParameterITunesItemIdentifier:appId};
[productViewController loadProductWithParameters:dictcompletion Block:^(BOOLresult,NSError*error) {
if(result) {
[self presentViewController:productViewController animated:YES completion:nil];
}
}];
}
#pragma mark -SKStoreProductViewControllerDelegate协议方法
//打开的应用下载页 导航栏自带取消按钮,对应此方法
- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController{
NSLog(@"取消事件");
[viewController dismissViewControllerAnimated:YES completion:nil];
}
//调用(id 别写错了~~~~)
[self openAppWithIdentifier:@"414478124"];
-
APP内部快捷评分(iOS10.3 +)
Tip: 此方式苹果允许的调用频率为 3次/年。
导入头文件import <StoreKit/StoreKit.h>
一步调用即可实现
[SKStoreReviewController requestReview];