从Unity打开iOS应用程序 [英] Open iOS application from Unity

查看:489
本文介绍了从Unity打开iOS应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Unity中的按钮按下我的ipad上的另一个应用程序。我通常知道我会在按下按钮时使用 Application.OpenURL(),但我不确定要放在括号中的内容。这是iPad上的一个应用程序,并不是我创建的应用程序。

I'm wanting to open up another application on my ipad via a button press in Unity. I know normally I would use Application.OpenURL() on my button press, but I'm unsure as to what to put in the brackets. This is an application already on the iPad and isn't one I've created.

有没有人曾经这样做过?你有可能指出我正确的方向,所以我可以让这个工作吗?甚至可能吗?

Has anyone ever done this before? Could you possibly point me in the right direction so I can get this to work? Is it even possible?

推荐答案

另一个应用程序需要支持这种行为,通过定义自定义网址
开发人员需要在目标>信息> URL类型下在Xcode中添加URL类型即awesomeapp,如果他不支持,则无法打开应用程序。

The other application needs to support that behaviour, by defining a custom url scheme. The developer needs add an URL Type i.e. "awesomeapp" in Xcode under Targets > Info > URL Types, if he does not support it you can not open the app.

在Unity应用中,只需致电

In your Unity app just call

Application.OpenURL("awesomeapp://").

另请参阅此stackoverflow条目:
从另一个(iPhone)启动应用程序

see also this stackoverflow entry: Launch an app from within another (iPhone)

更新1:如何查找第三方应用程序的自定义URL方案


  1. 在OSX上通过iTunes下载购买的应用程序

  2. 转到文件系统上的[AppName] .ipa文件

  3. 将其重命名为[AppName] .zip,以便您可以将其解压缩

  4. 转到[AppName] / Payload / [AppName] .app

  5. 右键单击并选择显示包装内容

  6. 在Xcode中打开Info.plist并查找关键 网址类型 ,或在文本编辑器中查找 CFBundleURLTypes

  1. Download the purchased app via iTunes on OSX
  2. Go to the [AppName].ipa file on your filesystem
  3. Rename it to a [AppName].zip so that you can extract it
  4. Go to "[AppName]/Payload/[AppName].app"
  5. Right click and select "Show Package Contents"
  6. Open the Info.plist in Xcode and look for the key URL types or in a text editor for CFBundleURLTypes.

更新2:iOS 9

对于iOS 9,您必须在Xcode项目的Info.plist中将该应用程序列入白名单:

For iOS 9 you must whitelist that application in the Info.plist of the Xcode Project:

<key>LSApplicationQueriesSchemes</key>
<array>
     <string>awesomeapp</string>
</array>

这篇关于从Unity打开iOS应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆