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. Profession ASP.NET MVC 2.0 NerdDinner示例可运行源码

    最近一段时间在看JonGalloway等著作的<Profession ASP.NET MVC 2.0>.本书并没有按照常规的大部头书籍那样,按部就班的介绍MVC的概念等,而是在第一章直接引 ...

  2. java用正则表达式获取domain

    在工作中经常用到获取url的来源和域名的黑白名单功能.前段时间写了一个获取url中域名的方法.但是在测试过程中发现有些小问题. /** * 根据URL获取domain * @param url * @ ...

  3. 寻找两个已序数组中的第k大元素

    寻找两个已序数组中的第k大元素 1.问题描述 给定两个数组与,其大小分别为.,假定它们都是已按照增序排序的数组,我们用尽可能快的方法去求两个数组合并后第大的元素,其中,.例如,对于数组,.我们记第大的 ...

  4. 线程内唯一对象HttpContext

    在asp.net中,HttpContext是主线程内唯一对象.在web应用中开启多线程,在另外一个线程中是无法访问HttpContext. 如果需要在另外一个线程中使用HttpContext.Curr ...

  5. 通过NSURL获取网络标准时间

    - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typica ...

  6. Linux centos7环境下安装MySQL的步骤详解

    Linux centos7环境下安装MySQL的步骤详解 安装MySQL mysql 有两个跟windows不同的地方 1).my.ini 保存到/etc/my.ini 2).用户权限,单独用户执行 ...

  7. html5新标签布局应用指南

    html5中为了便于设计者的网站布局新添加了一些标签,本文主要讲解这些标签的实际应用方法. 大多数前端的朋友在设计网站时主要应用<div>标签构造盒子进行布局,这是种非常高效的方法,可以将 ...

  8. 不惧面试:HTTP协议(1) - 基础扫盲

    v博客前言 先交代下背景,之前在一家公司面试.NET开发,去了先是做一份笔试题,有一半是关于HTTP协议的,技术总监直接面试,也是问一大堆HTTP协议的知识点,可能跟该公司的产品有关,该公司属于互联网 ...

  9. iOS开发-OC语言 (六)点语法和@property

    点语法和@property 知识点 1.setter/getter函数 2.点语法 3.@property语法和属性 ======================================== ...

  10. qdoc 简介

    Qdoc 介绍 Qdoc是开发者用于在软件工程中生成文档的一个工具.它从工程的源文件中提取qdoc类型注释,并以html页面或者DITA XML文档的形式格式化到文件中.Qdoc在.cpp和.qdoc ...