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 帐号 ...
随机推荐
- C#常用的数据格式转换
用DataFormatString格式化GridView 在 GridView里面显示数据,要显示的数据有好多位小数,就想让它只显示两位小数,在delphi里,直接用DisplayFormat就行了, ...
- Singleton模式C++实现
Singleton模式C++实现 Singleton是设计模式中比较简单的一个.园中的朋友们应该都很熟悉了.前段时间参加xxx外企的面试,和面试官讨论C++的时候正好写了一个.当时由于在有些地方考虑不 ...
- TOGAF架构开发方法(ADM)之架构变更管理阶段
TOGAF架构开发方法(ADM)之架构变更管理阶段 1.10 架构变更管理(Architecture Change Management) 企业架构开发方法各阶段——架构变更管理 1.10.1 目标 ...
- kivy create a package for Android
Now that you've successfully coded an app. Now you want to deploy it to Android. So now we would nee ...
- sql编程 && 存储过程
sql 结构化查询语言 是一种编程语言 用于管理数据库的编程语言 元素: 数据 数据类型 变量的数据类型 就是字段的数据类型 变 ...
- nginx整合tomcat集群并做session共享----测试案例
最近出于好奇心,研究了一下tomcat集群配置,并整合nginx,实现负载均衡,session共享,写篇记录,防止遗忘.---------菜鸡的自我修炼. 说明:博主采用一个web项目同时部署到两台t ...
- C#的FTP上传下载的实验
前段时间做了一个FTP操作服务器文件的实验,现在把一些经验写下来,免得忘记. 1.上传的处理:目标文件夹A上传到服务器指定目录.先检索服务器目录中有无同名文件夹,若有,则先改名,上传成功后再删除,上传 ...
- CSS3特性修改(自定义)浏览器默认滚动条
前言:我们做前端时,会遇到一些需求,要求把默认浏览器的滚动条样式给改写了,诶.好好的改它干啥了,也带不来用户体验,就是好看点嘛!实现原理其实是用了伪元素,webkit的伪元素实现很强,可以把滚动条当成 ...
- Linux学习笔记(一):常用命令(2)
3.帮助命令 A,帮助命令:man B,其他帮助命令 3.1,格式:man [命令名] 查看命令拥有哪个级别的帮助: ...
- MVC源码解析 - 进入CLR
这一篇是转载自汤姆大叔的一篇随笔. IIS 5 的 ASP.net 请求处理过程 IIS5核心特征是:IIS是允许在一个叫InetInfo.exe的进程上的,所以无论是aspx页面还是html页面都是 ...