是否可以强制iOS设备以编程方式从所述应用程序打开/切换到我的应用程序?(is it possible to force iOS device to open up / switch to my ap

编程入门 行业动态 更新时间:2024-10-27 18:19:59
是否可以强制iOS设备以编程方式从所述应用程序打开/切换到我的应用程序?(is it possible to force iOS device to open up / switch to my app from said app programatically?)

我想创建一个应用程序,当从该应用程序内部执行某个代码块时,该应用程序将打开并呈现给用户。 有可能吗?

另一个解决方案是显示本地警报通知,该通知将打开应用程序。 但是没有通知可以这样做吗?

I would like to make an app, that opens and present itself to a user when a certain block of code is executed from inside that app. Is it possible like that?

Another solution would be to display a local alert notification, that would open the app on tap. But is it possible to do that without the notification?

最满意答案

不,你不能直接打开另一个应用程序。

如果您想使用您的应用程序打开另一个应用程序,以实现URL方案。

以下是Objective-C中打开谷歌地图的基本示例

-(IBAction) openMaps:(id)sender { // Opens a map containing Envato's Headquarters UIApplication *ourApplication = [UIApplication sharedApplication]; NSString *ourPath = @"http://maps.google.com/maps?ll=-37.812022,144.969277"; NSURL *ourURL = [NSURL URLWithString:ourPath]; [ourApplication openURL:ourURL]; }

以下是在Objective-C中创建自定义URL方案的最佳教程。

Nope,You can't directly open the another app.

If you want to open another app using you app for that need to implement URL Schemes.

Here is basic example for open google map in Objective-C

-(IBAction) openMaps:(id)sender { // Opens a map containing Envato's Headquarters UIApplication *ourApplication = [UIApplication sharedApplication]; NSString *ourPath = @"http://maps.google.com/maps?ll=-37.812022,144.969277"; NSURL *ourURL = [NSURL URLWithString:ourPath]; [ourApplication openURL:ourURL]; }

And Here is best tutorial for create custom URL Schemes in Objective-C.

更多推荐

本文发布于:2023-08-07 14:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464685.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   所述   切换到   方式   设备

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!