如何在iOS 6.x中以静默方式在后台启动APP [英] How to launch an APP in background in iOS 6.x silently
问题描述
我们希望在iPhone中静默启动APP而不将此APP带到前台。在iOS 5.x中,我们通过以下代码实现此目标:
We want to launch an APP silently in iPhone without bring this APP to the Foreground. In iOS 5.x we achieve this goal by this code:
[(SBApplication*)app setDisplaySetting:0x4 flag:NO];
[(SBDisplayStack*)displayStack pushDisplay:app];
[(SBDisplayStack*)displayStack popDisplay:app];
但是,在iOS 6.x中,不再有SBDisplayStack。我做了一些搜索,但没有找到任何答案。有人说SBWorkSpace取代了iOS 6.x中的SBDisplayStack。我们使用SBAppToAppWorkspaceTransaction来实现,但始终将APP带到Foreground,这无法实现我们的目标。
But, in iOS 6.x there is not SBDisplayStack any more. I did some search but not found any answers. Someone says that SBWorkSpace replaces the SBDisplayStack in iOS 6.x. We use SBAppToAppWorkspaceTransaction to implement but always bring the APP to the Foreground which dose not achieve our goal.
任何人都可以帮助我吗? Thx!
Anyone can help me? Thx!
推荐答案
您可以使用 SBSLaunchApplicationWithIdentifier()
函数 SpringBoardServices
私有框架。需要暂停
参数:
You can use the SBSLaunchApplicationWithIdentifier()
function from the SpringBoardServices
private framework. It takes a suspended
argument:
SBSLaunchApplicationWithIdentifier(CFSTR("com.company.app"), TRUE);
您还需要 com.apple.springboard.launchapplications
此权利。
这篇关于如何在iOS 6.x中以静默方式在后台启动APP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!