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的购买页面的更多相关文章

  1. ios真机使用fixed定位页面滚动时fixed定位的元素也会跟着滚动

    到了ios真机APP中,页面向下滚动,fixed的元素也跟着滚,虽然最后它还是到了它该在的地方,但是它跟着滚动也很影响页面的流畅性和交互性好伐.

  2. vue打包app嵌入h5,区分app进入和android,ios显示不同的下载链接

    vue打包app嵌入h5,区分app进入和android,ios显示不同的下载链接 需求:自己app打开的登录页面不显示app下载链接.其他地方打开判断android手机的跳转到android下载页链 ...

  3. iOS高仿app源码:纯代码打造高仿优质《内涵段子》

    iOS高仿app源码:纯代码打造高仿优质<内涵段子>收藏下来 字数1950 阅读4999 评论173 喜欢133 Github 地址 https://github.com/Charlesy ...

  4. iPhone的App嵌入html页面问题

    测试环境:iPhone ios 11.0.3 问题:iPhone App嵌入HTML页面,页面拉动到底部时,手势从屏幕底部边缘开始往上拉动,页面出现白色图层,且html页面一屏外的会卡住,无法滚动,需 ...

  5. <iOS开发>之App上架流程(2017)

    本文主要介绍了App上架流程,以及上架过程中会遇到的一些问题. 一.App上架前的准备. 上架前,需要开发人员有苹果开发者账号,具体请阅读苹果开发者账号注册申请流程.本文是在已经拥有开发者账号的前提下 ...

  6. iOS-----GitHub上比较齐全的iOS 工具和App

    Github-iOS 工具 和 App   系统基础库 Category/Util sstoolkit 一套Category类型的库,附带很多自定义控件 功能不错-       BFKit 又一套Ca ...

  7. iOS 轻松使用 App 数据统计

    想获取用户各项行为数据吗? 想轻松查看用户行为图表吗? 想高效进行 App 运营管理吗? 想,来我带你玩转 App 数据统计.这里我使用专业.轻便的 JAnalytics. 本文内容分为两部分:代码示 ...

  8. ios两个app之间跳转,传值的实现

    两个APP之间的跳转是通过[[UIApplication sharedApplication] openURL:url]这种方式来实现的. 1.首先设置第一个APP的url地址 2.接着设置第二个AP ...

  9. iOS 最新公布app到AppStore全流程具体解释

    一.生成公布证书(证书的作用:类似于驾照,证明你的身份能够进行开发人员一些操作) 打开https://developer.apple.com 点击右上角开发人员中心 这里输入你付款过的Apple 帐号 ...

随机推荐

  1. JQuery.Ajax + 跨域 (crossDomain) + POST + JSON + WCF RESTful, 5大陷阱和解决方案

    JQuery.Ajax + 跨域 (crossDomain) + POST + JSON + WCF RESTful, 5大陷阱和解决方案 最近在开发WSS RESTful服务的时候, 碰到了这些个纠 ...

  2. WampServer Mysql配置

    WAMP:Windows下的Apache+Mysql+Perl/PHP/Python,一组常用来搭建动态网站或者服务器的开源软件.可点击此处下载WampServer,然后,按照提示安装WAMP.需要说 ...

  3. MySQL能够承受上亿万条的数据量的架构

    MySQL能够承受上亿万条的数据量的架构 最近做的搜索引擎的数据量是越来越大估计了下在中国可能涉及到的1Kw的数据量,就全球来说也就是1K亿而已,最初是用的数据库是MySQL现在来说要做些优化,最终使 ...

  4. WCF心跳判断服务端及客户端是否掉线并实现重连接

    WCF心跳判断服务端及客户端是否掉线并实现重连接 本篇文章将通过一个实例实现对WCF中针对服务端以及客户端是否掉线进行判断:若掉线时服务器或客户端又在线时将实现自动重连:将通过WCF的双工知识以及相应 ...

  5. VMwarevSphere 服务器虚拟化之二十九 桌面虚拟化之安装View副本服务器

    VMwarevSphere 服务器虚拟化之二十九  桌面虚拟化之安装View副本服务器 VMware View中高可用性可是一个必须要考虑的问题.在整个虚拟桌面环境中View Connection S ...

  6. 作为IT行业计算机从业人士,不要做“邻居盖新房,你就是背后放火的那种人”

    金华-普通人(214103872)  21:03:01 尽扯蛋   颇有点凤姐的营销方式  横瓜(601069289)  21:05:16 不服气 你搞一个下面的类似软件出来 http://www.s ...

  7. linux 下把Caps_Lock 映射成Ctrl

    我用的是debian 7,以前是gnome桌面,系统里就有改变键盘布局的设置.之前gnome 崩了一次,就换成了openbox ,稍微配置了一下也可以很好使用. 可以参考这篇文章 5分钟openbox ...

  8. Android 关于ListView中按钮监听的优化问题(方法二)

    关于ListView中按钮监听的优化问题(方法一)地址: http://www.cnblogs.com/steffen/p/3951901.html 之前的方法一,虽然能够解决position的传递, ...

  9. Putty的注册表设置

    Putty是一款非常好用的远程管理Linux系统的工具,其主要具有以下几个优点:  完全免费;  在Windows 9x/NT/2000下运行的都非常好;  全面支持SSH1和SSH2:  绿色软件, ...

  10. js导出execl兼容ie Chrome Firefox各种主流浏览器(js export execl)

    第一种导出table布局的表格 <html> <head> <meta charset="utf-8"> <script type=&qu ...