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 帐号 ...
随机推荐
- springMVC3学习(一)--框架搭建
由于项目需要,学习下springMVC,在此简单记录一下. 如有十万个为什么,暂且忽略,待以后研究. 本人是基于3.1.1版本开发,如遇jar包版本冲突等其他问题,概不负责. 下载地址:上传此zip资 ...
- javascript call()函数
js中的call()函数,简单的说就是用来纠正指正的吧! 调用一个对象的方法,用另一个对象替换当前对象,这样说显得相当的空洞与抽象,实例说明一切! <script type="text ...
- (Sql Server)数据的拆分和合并
(Sql Server)数据的拆分和合并 背景: 今天遇到了数据合并和拆分的问题,尝试了几种写法.但大致可分为两类:一.原始写法.二.Sql Server 2005之后支持的写法.第一种写法复杂而且效 ...
- Linux中添加管理员权限问题:xxx is not in the sudoers file. This incident will be reported.
在各个不同版本的linux中添加拥有管理员权限账户有不同的简便方式. 问题: 今天遇见将新添用户添加到root用户组后,运行sudo仍然提示 ”xxx is not in the sudoers fi ...
- 64位CentOS 6.0下搭建LAMP环境
系统环境:Centos6.0 x64 1.确认搭建LAMP所需要的环境是否已经安装 [root@centos6 ~]# rpm -q make gcc gcc-c++ zlib-devel libai ...
- 设计模式:空对象模式(Null Object Pattern)
设计模式:空对象模式(Null Object Pattern) 背景 群里聊到<ASP.NET设计模式>,这本书里有一个“Null Object Pattern”,大家就闲聊了一下这个模式 ...
- poj 2378 树型dp
和poj1655那道求树的重心基本上一样的,代码也没多大改动. 详情请见 #include<cstdio> #include<algorithm> #include<cs ...
- 【Android LibGDX游戏引擎开发教程】第07期:中文字体的显示和绘制(上)
在字体的显示和绘制中,Libgdx的作者(Mario Zechner,美国人)给我们提供了一个非常好用的工具 ——Hiero,那么下面就来看看它具体的使用方法. 一.Hiero工具的使用 1.Hier ...
- nodejs,http,get,post,请求
本文源于实践及其部分网络搜索: 其实大部分,官方都有介绍... 官方参考链接:https://nodejs.org/api/http.html var http = require('http'); ...
- Virtualbox中的Linux:未能加载虚拟光驱 VBoxsGuestAdditions.iso到虚拟电脑
安装增强功能 出现了 这个问题,需要弹出光盘,再次安装.