PHP Api iOS-从PHP代码启动应用程序? [英] PHP Api iOS - Launch app from PHP code?

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

问题描述

我试图使用Framework 7创建一些Web应用程序.一切都很好,但是我希望能够从主屏幕调用一个应用程序(例如,Store或News应用程序).

I was trying to create some web app using Framework 7. Everything's fine, but i'd like to be able to call an app from the Home Screen (for example, the Store or the News app).

我知道有些API是由Apple Inc.发布的,但是我找不到从我的PHP代码中调用应用程序的方法.

I know that some APIs are published by Apple Inc, but I can't find a way to call an app from my PHP code.

该Web应用程序被创建为可在Safari中运行.

The Web app is created to run in Safari.

我尝试过类似的事情:

<script type="text/javascript" charset="utf-8">

                window.location = "myapp://iMessage";

    </script>

但是它似乎无法启动该应用程序.

But it doesn't seem to be able to launch the app.

推荐答案

在iOS 9之前

要在iOS中打开另一个应用,您需要知道它支持什么方案.并非所有应用程序都使用它们,因此并非每个应用程序都可以这种方式打开.打开AppStore的示例方案如下所示:

Before iOS 9

In order to open another app in iOS you need to know what schemes it supports. Not all apps use them, so not every app is openable this way. An example scheme that opens up AppStore looks like this :

itms://itunes.apple.com/us/app/apple-store/id375380948?mt=8

这将在"Apple Store"上打开AppStore.应用程序屏幕.您也可以通过将itms替换为https并粘贴到浏览器中来进行测试. itms部分是scheme,其余部分是传递给应用程序的参数.

This will open AppStore on "Apple Store" apps screen. You can test this also by replacing itms with https and pasting in your browser. The itms part is the scheme, and the rest are the parameters passed to the app.

应用可以注册以处理通用"域名. URLS,所以像 http://9gag.com/gag/a1MXxR2将在9GAG应用程序中打开(除非用户不同意-首次在Safari中打开此类链接时,系统会询问他,然后将在Safari中打开它.)

Apps can register to handle "generic" URLS, so a URL like http://9gag.com/gag/a1MXxR2 will be opened in 9GAG app (unless the user doesn't agree to it - he will be asked the first time he opens such a link in Safari, then it will be opened in Safari).

请注意,并不是所有的应用程序都支持它,并且(除了要求创建者之外)没有办法知道他们是否愿意.

Note that not all apps support it yet, and there is no way (apart from asking the creators) to know if they ever will.

因此,回答您的问题:没有通用的方法可以打开随机"窗口.应用安装在某人的手机上.尤其是不支持不通过URL打开的应用程序(无论是使用自定义方案还是http(s)).

So to answer your question : there is no generic way to open a "random" app installed on someones phone. Especially not apps which don't support such opening via URLs (no matter whether with a custom scheme, or http(s)).

一些流行的应用程序(Facebook,Twitter,Chrome等)发布了它们的方案,并且您可以实施它们,但并非所有人都可以实现.

Some of the popular apps (Facebook, Twitter, Chrome, ...) publish their schemes and you can implement them, not all will do so.

注意:这全部适用于非越狱的手机.

Note: this all applies to non-jailbroken phones.

这篇关于PHP Api iOS-从PHP代码启动应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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