繁体   English   中英

在后台运行时打印iOS应用

[英]iOS app printing while running in the background

我有一个iOS应用程序,当有订单进入并且效果很好时,它会自动将收据打印到热敏收据打印机。 但是,如果该应用程序在后台运行,则不会打印。 是否可以在后台运行时允许其打印?

在少数情况下,允许您在后台运行某些任务。 请参阅Apple文档: https : //developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20

例如:允许在后台播放音频,获取用户位置,从网络发送通知或某些数据。 据我了解,不允许在后台服务期间运行自己的逻辑(例如,在您的应用进入睡眠/后台模式一小时后运行它)。

唯一可能的选择是利用按下主页按钮后应用必须完成任务的时间。 但是有10或15分钟的时间限制。 我不知道这是否适合您的情况? 请参阅以下stackoverflow问题: iOS应用程序在后台执行任务,以及在后台运行任务的这段特殊代码: https : //stackoverflow.com/a/11809211/2740112

另一种选择是使用iOS 6以来引入的Guided Access。 有了它,您可以防止退出应用程序。 仅在仅使用需要使用的设备上的应用程序时才有用。 以下来自http://www.assistiveware.com/support/faq/page/136的信息:

要打开引导访问,请执行以下操作:

Go to the Settings app on your device's home screen.
Tap General.
Tap Accessibility.
Under the Learning section (scroll down if necessary), tap Guided Access.
Toggle Guided Access to ON.
Tap Set Passcode and enter a four digit passcode. You will be prompted to enter it again.
(Optional) Toggle Enable Screen Sleep to ON if you want to be able to put your device to sleep with the Power button, otherwise the Power button will be disabled. 

要启动应用程序的“引导式访问”并防止其退出,请执行以下操作:

Open the app that you want to lock in. 
Quickly press your device's Home button three times to bring up the Guided Access menu. 
Tap the Start button in the top right corner of the screen to activate Guided Access. A message stating "Guided Access Started" will briefly appear. 

要结束某个应用程序的“引导访问”,以便可以退出该应用程序,请执行以下操作:

Quickly press your device's Home button three times to bring up the Guided Access menu.
Enter your four digit passcode when prompted. 
Tap the End button in the top left corner of the screen to end Guided Access. A message stating "Guided Access Ended" will briefly appear.

这是Apple的知识库文章: http : //support.apple.com/kb/ht5509

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM