ios 显示其他app的购买页面
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices ; public class IOSDoor : MonoBehaviour { // Use this for initialization
void Start () { } // Update is called once per frame
void Update () { } [DllImport("__Internal")]
private static extern void ShowBook ( int bookid ); public static void ActivateButton0 ()
{
Debug.Log ();
if (Application.platform != RuntimePlatform.OSXEditor)
{
//点击按钮后调用xcode中的 _PressButton0 ()方法,
//方法中的内容须要我们自己来添加
ShowBook ();
}
} [DllImport("__Internal")]
private static extern void _ShowBookApp ( string bookid ); public static void ShowBookApp (string bookid )
{
Debug.Log ( + "ShowBookStr" + bookid);
if (Application.platform != RuntimePlatform.OSXEditor)
{
//点击按钮后调用xcode中的 _PressButton0 ()方法,
//方法中的内容须要我们自己来添加
_ShowBookApp ("");
}
} }
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
.............................. NSLog(@"eeee") ;
UnityViewController * uv = [[UnityViewController alloc] init] ;
//[uv.view setFrame:CGRectMake(0, 200, 320, 200)];
//uv.view.backgroundColor = [UIColor blackColor];
[UnityGetGLViewController().view addSubview:uv.view] ; [UnityViewController setInstance:uv]; return YES;
}
//
// UnityViewController.h
// Unity-iPhone
//
// Created by lc—— on 16/6/13.
//
// #import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h> @interface UnityViewController : UIViewController<SKStoreProductViewControllerDelegate> - (void)showStoreProductInApp:(NSString *)appID ;
+(void) setInstance: ( UnityViewController *) inst ;
+(UnityViewController *) getInstance ;
@end
//
// UnityViewController.m
// Unity-iPhone
//
// Created by lc—— on 16/6/13.
//
// #import "UnityViewController.h" @interface UnityViewController () @end @implementation UnityViewController void ShowBook( int bookID )
{
NSLog(@"rrrrr") ;
//[[UnityViewController getInstance] showStoreProductInApp:@"1073005459"];
[[UnityViewController getInstance] showStoreProductInApp:[NSString stringWithFormat:@"%d" , bookID]];
}
void _ShowBookApp( const char * bookID )
{
NSString * bookIDStr = [NSString stringWithUTF8String:bookID] ;
NSLog(@"rrrr r --- %@" , bookIDStr) ;
[[UnityViewController getInstance] showStoreProductInApp:@""];
// NSString * bookIDStr = [NSString stringWithUTF8String:bookID] ;
//[[UnityViewController getInstance] showStoreProductInApp:bookIDStr];
} void _ShowBookStar( const char * bookID )
{
NSLog(@"rrrrr") ;
// //[[UnityViewController getInstance] showStoreProductInApp:@"1073005459"];
NSString * bookIDStr = [NSString stringWithUTF8String:bookID] ;
[[UnityViewController getInstance] loadAppStoreController:bookIDStr];
} static UnityViewController * instance ;
+(UnityViewController *) getInstance
{
return instance ;
} +(void) setInstance: ( UnityViewController *) inst
{
instance = inst ;
} - (void)viewDidLoad {
[super viewDidLoad];
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} - (void)loadAppStoreController:(NSString *)appID { NSLog(@"rrrrr--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:^{ }]; } }]; } - (void)showStoreProductInApp:(NSString *)appID{ Class isAllow = NSClassFromString(@"SKStoreProductViewController"); NSLog(@"ttt") ; if (isAllow != nil) { SKStoreProductViewController *sKStoreProductViewController = [[SKStoreProductViewController alloc] init];
[sKStoreProductViewController.view setFrame:CGRectMake(, , , )];
[sKStoreProductViewController setDelegate:self];
[sKStoreProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier: appID}
completionBlock:^(BOOL result, NSError *error) {
if (result) {
[self presentViewController:sKStoreProductViewController
animated:YES
completion:nil];
// [self removeNotice]; }else{
NSLog(@"error:%@",error);
}
}];
}else{
//低于iOS6的系统版本没有这个类,不支持这个功能
NSString *string = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/xxxxxxx/app/id%@?mt=8",appID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
}
} #pragma mark - SKStoreProductViewControllerDelegate
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[viewController dismissViewControllerAnimated:YES completion:nil];
} /*
#pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/ @end
ios 显示其他app的购买页面的更多相关文章
- ios真机使用fixed定位页面滚动时fixed定位的元素也会跟着滚动
到了ios真机APP中,页面向下滚动,fixed的元素也跟着滚,虽然最后它还是到了它该在的地方,但是它跟着滚动也很影响页面的流畅性和交互性好伐.
- vue打包app嵌入h5,区分app进入和android,ios显示不同的下载链接
vue打包app嵌入h5,区分app进入和android,ios显示不同的下载链接 需求:自己app打开的登录页面不显示app下载链接.其他地方打开判断android手机的跳转到android下载页链 ...
- iOS高仿app源码:纯代码打造高仿优质《内涵段子》
iOS高仿app源码:纯代码打造高仿优质<内涵段子>收藏下来 字数1950 阅读4999 评论173 喜欢133 Github 地址 https://github.com/Charlesy ...
- iPhone的App嵌入html页面问题
测试环境:iPhone ios 11.0.3 问题:iPhone App嵌入HTML页面,页面拉动到底部时,手势从屏幕底部边缘开始往上拉动,页面出现白色图层,且html页面一屏外的会卡住,无法滚动,需 ...
- <iOS开发>之App上架流程(2017)
本文主要介绍了App上架流程,以及上架过程中会遇到的一些问题. 一.App上架前的准备. 上架前,需要开发人员有苹果开发者账号,具体请阅读苹果开发者账号注册申请流程.本文是在已经拥有开发者账号的前提下 ...
- iOS-----GitHub上比较齐全的iOS 工具和App
Github-iOS 工具 和 App 系统基础库 Category/Util sstoolkit 一套Category类型的库,附带很多自定义控件 功能不错- BFKit 又一套Ca ...
- iOS 轻松使用 App 数据统计
想获取用户各项行为数据吗? 想轻松查看用户行为图表吗? 想高效进行 App 运营管理吗? 想,来我带你玩转 App 数据统计.这里我使用专业.轻便的 JAnalytics. 本文内容分为两部分:代码示 ...
- ios两个app之间跳转,传值的实现
两个APP之间的跳转是通过[[UIApplication sharedApplication] openURL:url]这种方式来实现的. 1.首先设置第一个APP的url地址 2.接着设置第二个AP ...
- iOS 最新公布app到AppStore全流程具体解释
一.生成公布证书(证书的作用:类似于驾照,证明你的身份能够进行开发人员一些操作) 打开https://developer.apple.com 点击右上角开发人员中心 这里输入你付款过的Apple 帐号 ...
随机推荐
- easyui datagrid自定义操作列
通过formatter方法给Jquery easyui 的datagrid 每行增加操作链接 我们都知道Jquery的EasyUI的datagrid可以添加并且自定义Toolbar, 这样我们选择一行 ...
- 跨平台C/C++集成开发环境-Code::Blocks-内置GCC
Code::Blocks 是一个开放源码的全功能的跨平台C/C++集成开发环境. 相比于基于Delphi的Dev-C++共享C++IDE,Code::Blocks是开放源码软件.Code::Block ...
- Android While 循环导致的资源占用过高进而导致程序崩溃问题
Timeline: Activity_launch_request time:6562004-14 15:31:25.347: I/dalvikvm(3483): Total arena pages ...
- IOS开发小记-内存管理
关于IOS开发的内存管理的文章已经很多了,因此系统的知识点就不写了,这里我写点平时工作遇到的疑问以及解答做个总结吧,相信也会有人遇到相同的疑问呢,欢迎学习IOS的朋友请加ios技术交流群:190956 ...
- Spring注解用法
1. Controller层:@Controller @Controller @RequestMapping("/user")//请求localhost:8080/user/*** ...
- .net程序员求职简历
.net程序员求职简历 个人概况 姓名 齐志超 学历 专科 毕业学校 河北软件职业技术学院 专业 软件开发与设计 手机 18730269286 年龄 22 性别 男 现居住地 北京 电子邮件 qzc9 ...
- [置顶] Oracle学习经验谈
经常遇到朋友问oracle学习难不难,怎么才能成为高手等等,我想结合我的个人经验简单说几点: 1.打好基础,由浅入深 学习Oracle不能急于求成,寄希望于一天成为一个大侠.学习有个过程,应该由浅入深 ...
- MVC源码解析 - 配置注册 / 动态注册 HttpModule
本来这一篇, 是要继续 Pipeline 的, 但是在 Pipeline之前, 我看到了InitModules()方法, 所以决定, 在中间穿插一篇进来. 这一篇来讲一下 IHttpModule 的加 ...
- IE条件注释,嗅探低版本IE用户,并引导升级
一.科普IE条件注释 IE条件注释功能是条件注释是IE特有的一种功能,能对IE系列产品进行单独的XHTML代码处理,注意,主要是针对XHTML,而非CSS.条件注释功能非常强大,可以进行true和fa ...
- linux 安装 Chrome
一.添加PPA 从Google Linux Repository(http://www.google.com/linuxrepositories/)下载安装Key,或把下面的代码复制进终端,回车,需要 ...