赞
踩
【1】应用内跳转到App Store页
使用官方 StoreKit.framework 框架
-
- #import <StoreKit/StoreKit.h>
-
- - (void)OnButtonClick {
- NSDictionary *dict = [NSDictionary dictionaryWithObject:@"440948110" forKey:SKStoreProductParameterITunesItemIdentifier];
- SKStoreProductViewController *ctrl = [[SKStoreProductViewController alloc] init];
- ctrl.delegate = self;
- [ctrl loadProductWithParameters:dict completionBlock:^(BOOL result, NSError * _Nullable error) {
- if(error) {
- NSLog(@"Error:%@",error.userInfo);
- }
- else {
- [self presentViewController:ctrl animated:YES completion:nil];
- }
- }];
- }
-
-
- #pragma mark - SKStoreProductViewControllerDelegate
-
- - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
- [viewController dismissViewControllerAnimated:YES completion:^{
- NSLog(@"productViewControllerDidFinish");
- }];
- }
【2】跳转到App Store应用的URL
- NSString *urlstr = @"https://itunes.apple.com/app/apple-store/id440948110?mt=8";
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlstr]];
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。