iOS 应用内跳转到appstore里下载
SKStoreProductViewController类是UIViewController的子类, 如果你对view controller比较熟悉的话,那SKStoreProductViewController使用起来也非常简单了。当你希望向用户展示App Store中产品时,你需要:
1.实例化一个SKStoreProductViewController类
2.设置它的delegate
3.把sotre product视图控制器显示给消费者
剩下的就交给操作系统来处理了。需要记住一点的是SKStoreProductViewController只能以模态的方式显示。SKStoreProductViewControllerDelegate协议定义了一个单独的方法—productViewControllerDidFinish:,当消费者离开App Store时会调用这个方法—一般是通过点击左上角画面中的取消按钮。通过给代理发送productViewControllerDidFinish:消息,操作系统就会把控制权返回到你的程序。当然你不能忘了 只支持IOS6.0及其以上~~
步骤:
1.添加 storeKit.framework
2.头文件里 加上
#import <StoreKit/StoreKit.h>
@interface ViewController : UIViewController<SKStoreProductViewControllerDelegate>
3.直接在m中实现
- (IBAction)doAction:(UIButton *)sender {
[self showAppInApp:@"xxxxxx"];//此处xxxxx需要替换为需要的appID
}
- (void)showAppInApp:(NSString *)_appId {
Class isAllow = NSClassFromString(@"SKStoreProductViewController");
if (isAllow != nil) {
SKStoreProductViewController *sKStoreProductViewController = [[SKStoreProductViewController alloc] init];
sKStoreProductViewController.delegate = self;
[sKStoreProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier: _appId}
completionBlock:^(BOOL result, NSError *error) {
if (result) {
[self presentViewController:_SKSVC
animated:YES
completion:nil];
}
else{
NSLog(@"%@",error);
}
}];
}
else{
//低于iOS6没有这个类
NSString *string = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/us/app/id%@?mt=8",_appId];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
}
}
#pragma mark - SKStoreProductViewControllerDelegate
//对视图消失的处理
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[viewController dismissViewControllerAnimated:YES
completion:nil];
}
iOS 应用内跳转到appstore里下载的更多相关文章
- ios应用内跳转到appstore里评分
NSString *str = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore ...
- iOS应用内跳转到指定系统设置页
APP的跳转: 通过[ [UIApplication sharedApplication] openURL:url]这种方法来实现的. iOS 10以后跳转设置页要用 [[UIApplication ...
- 关于在iOS应用中跳转到AppStore
1.获取app 在AppStore上的网址 eg: NSString * appURLStr = @"https://itunes.apple.com/cn/app/shi-ke-zu-qi ...
- h5 js判断是安卓还是ios设备,跳转到对应的下载地址
/*ios和安卓跳转 js*/$(function(){ var u = navigator.userAgent; var ua = navigator.userAgent.toLowerCase() ...
- iOS应用内跳转系统设置相关界面的方法
在iOS开发中,有时会有跳转系统设置界面的需求,例如提示用户打开蓝牙或者WIFI,提醒用户打开推送或者位置权限等.在iOS6之后,第三方应用需要跳转系统设置界面,需要在URL type中添加一个pre ...
- iOS 应用内跳转到系统设置
在iOS5下面版本号使用下面方法:[IOS5.1+之后不能使用此方法.iOS8的跳转方法已找到见下方,iOS7的正在摸索,欢迎大家给出观点意见] 通过URL Scheme的方式打开内置的Setting ...
- iOS应用内跳转百度高德苹果地图
移动开发经常用到基于位置的一些导航功能,但是对于对导航功能依赖性不强的的应用,我们直接采用应用外跳转地图APP即可. 但是应用间跳转,首先需要设置白名单, 在iOS 9 下涉及到平台客户端跳转,系统会 ...
- iOS APP版本更新跳转到App Store下载/更新方法
使用下面的连接即可跳转到App Store itms-apps://itunes.apple.com/cn/app/id*********** 其中********* ...
- iOS开发中,应用内直接跳转到Appstore
iOS开发中,应用内直接跳转到Appstore 1.进入appstore中指定的应用NSString *str = [NSString stringWithFormat: ...
随机推荐
- Metronic_下拉列表Select2插件的使用
这个插件是基于Select的扩展插件,能够提供更加丰富的功能和用户体验,它的github官网地址为:https://select2.github.io/,具体的使用案例,可以参考地址:https:// ...
- 基于HTML5实现的超酷摄像头(HTML5 webcam)拍照功能 - photobooth.js
在线演示 WebRTC可能是明年最受关注的HTML5标准了,Mozilla为此开发了一套帮助你控制硬件的API,例如,摄像头,麦克风,或者是加速表.你可以不依赖其它的插件来调用你需要的本机硬件设备. ...
- [转自51CTO]ITIL与ISO20000的关系
ITIL它不是一个服务管理标准,而更应该说是一种结构化的方法或流程框架.基于这种方法和框架,已经有越来越多的IT服务管理标准被开发出来了.在这些基于ITIL的IT服务管理标准中,最突出的要属英国标准B ...
- 使用Android Studio和Genymotion模拟器搭建Andriod开发环境
一.Android Studio下载 1.打开http://www.android.com/ 2.依照下图步骤打开下载页面 a.在页脚部分点击“App Developer Resources” b.点 ...
- HDU 2087 kmp模板题
s为主串 t为模板串 求t的nextt 加const #include<stdio.h> #include<string.h> #include<algorithm> ...
- DS实验题 Inversion
题目: 解题过程: 第一次做这题的时候,很自然的想到了冒泡和选择,我交的代码是用选择写的.基本全WA(摊手). 贴上第一次的代码: // // main.cpp // sequenceschange ...
- TenxCloud时速云.htaccess不起作用的解决办法
在新建容器时添加变量: ALLOW_OVERRIDE ,并将值设置为 TURE 即可.
- C#winfrom控件命名规范
※用红字标记的部分表示有重复出现,括号内为替代表示方案 1.标准控件 序号 控件类型简写 控件类型 1 btn Button 2 chk CheckBox 3 ckl CheckedListBox ...
- mysql之触发器trigger 详解
为了梦想,努力奋斗! 追求卓越,成功就会在不经意间追上你 mysql之触发器trigger 触发器(trigger):监视某种情况,并触发某种操作. 触发器创建语法四要素:1.监视地点(table) ...
- P2409 Y的积木
luogu月赛 暴力dfs,估计过不了几个点,大概也就得30分左右? #include <bits/stdc++.h> using namespace std; const int max ...