将App带到前台 [英] Bring App to foreground

查看:200
本文介绍了将App带到前台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法可以在计时器用完后将我的应用程序带到前台吗?这适用于在用户会话期间在各个点显示某些信息的自助服务终端类型应用。

Is there a way to bring my app to the foreground once a timer runs out? This is for a kiosk-type app that'll display some information at various points during user's session.

这适用于仅安装在我们企业设备上的应用因此不会提交给Apple批准。我也开始探索越狱选项。

This is for an app that will only be installed on our enterprise devices, thus not be submitted to Apple for approval. I am also opening to exploring jailbreak options.

我很感激你们可以提供的任何帮助/提示。谢谢。

I'd appreciate any help/tips you guys can provide. Thanks.

推荐答案

是的,您可以在技术上使用Xcode进行越狱开发(但您不必)。如果您希望将应用安装在普通沙箱之外,并且 / Applications / ,那么您需要使用Xcode 进行构建,无需代码签名,伪代码签名(或使用自签名证书),然后使用 scp 或类似的东西(可能有一个脚本)将应用程序复制/安装到您的设备上。

Yes, you can technically use Xcode for jailbreak development (but you don't have to). If you want your app to be installed outside the normal sandbox, and in /Applications/, then you'd build with Xcode without code signing, fake code sign (or use self-signed certificate), and then copy/install the app to your device, using scp or something similar (maybe have a script for this).

您也可以搜索Theos,Logos或iOSOpenDev等工具。 此处更多内容

You can google search on tools like "Theos", "Logos", or "iOSOpenDev", too. More here

此外,请参阅有关使用Xcode进行虚假代码签名的信息,请此页面

Also, see this page for information about fake code signing with Xcode.

在将应用程序带到前台方面,至少有几种方法可以解决这个问题:

In terms of bringing an app to the foreground, there's at least a couple ways to handle that:

一种方法是使用Cydia安装(免费)实用程序 open 。使用 open ,您可以发出命令行调用以打开任何应用程序,方法是使用其捆绑ID(例如 open com.mycompany.MyAppName )。如果要以编程方式执行此操作,请在 system()调用中发出该命令:

One would be to use Cydia to install the (free) utility open. With open, you can issue a command line call to open any app, by using its bundle ID (e.g. open com.mycompany.MyAppName). If you want to do this programatically, issue that command within a system() call:

 #import <stdlib.h>

 int returnCode = system("/usr/bin/open com.mycompany.MyAppName");

另一种选择 @WrightsCS看到这个答案。请务必仔细阅读评论内容。

Another alternative is to see this answer by @WrightsCS. Make sure to read the comments, too, about where this goes.

更新:将您的应用程序置于后台的条款,您可以使用 exit(0) [[UIApplication sharedApplication] terminateWithSuccess]完全终止您的应用程序。或者,查看此答案以获得以编程方式模拟主页按钮按下的解决方案,该应用程序将应用程序发送到后台而不会被查杀它。

Update: in terms of putting your app into the background, you can kill your app completely with either exit(0) or [[UIApplication sharedApplication] terminateWithSuccess]. Or, see this answer for a solution to programmatically simulate a home button press, which will send the app to the background without killing it.

你将无法使用 NSTimer ,因为你的应用程序时计时器不会触发在后台。但是,可以使用GCD 来运行后台工作,并使用<$调用 system() c $ c>打开让你回到前台。

You won't be able to use NSTimer, because timers don't fire while your app is in the background. However, you can use GCD blocks to run your background work, and make the system() call with open to bring you back to the foreground.

看到这个答案,可能一直滚到他帖子的底部

或者看看这个类似的答案,它实际上已经发布在问题的底部

这篇关于将App带到前台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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