ios 我可以从 iPhone 上的其他应用程序启动一个应用程序吗
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10149129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I launch one app from other app on iPhone
提问by Matrosov Alexander
I want to create app which have to launch another app and run some features in last.
我想创建必须启动另一个应用程序并在最后运行一些功能的应用程序。
I mean my app A call app B and run in B some method.
我的意思是我的应用程序 A 调用应用程序 B 并在 B 中运行某种方法。
Can I do this?
我可以这样做吗?
I know that I want to use URL scheme, but can I run some method in another app?
我知道我想使用 URL 方案,但我可以在另一个应用程序中运行某些方法吗?
Thanks!
谢谢!
回答by TheCodeKing
Yes you can achieve this using custom URL Schemes. See Communicating with Other Apps.
是的,您可以使用自定义 URL Schemes 来实现这一点。请参阅与其他应用程序通信。
App B will need to register a custom URL Scheme which App A uses to launch B and pass it commands.
App B 需要注册一个自定义的 URL Scheme,App A 使用它来启动 B 并向它传递命令。
The following code fragment illustrates how one app can request the services of another app. “todolist” in this example is a hypothetical custom scheme registered by App B.
以下代码片段说明了一个应用程序如何请求另一个应用程序的服务。本例中的“todolist”是 App B 注册的假设自定义方案。
NSURL *myURL = [NSURL URLWithString:@"todolist://www.acme.com?Quarterly%20Report#200806231300"];
[[UIApplication sharedApplication] openURL:myURL];
回答by skytz
No..apple is very strict about this kind of thing. The ios sandbox designe doesn't allow this anyway.The only way i can think of doing this is to pop an alert view and ask the user very nicely to do it :) ....either that or call a server and do your method on that server but triggering methods from an app to another is a sure No-No. Hell...you can't even detect what apps the user has installed...
不。。苹果对这种事情很严格。无论如何,ios 沙箱设计不允许这样做。我能想到的唯一方法是弹出一个警报视图并要求用户非常好地执行此操作:) ....要么调用服务器并执行您的操作该服务器上的方法,但从应用程序到另一个应用程序触发方法是肯定的。地狱......你甚至无法检测到用户安装了哪些应用......