如何使用Springboard Services Framework来使用SBSLaunchApplicationWithIdentifier [英] How to use Springboard Services Framework to use SBSLaunchApplicationWithIdentifier

查看:718
本文介绍了如何使用Springboard Services Framework来使用SBSLaunchApplicationWithIdentifier的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Springboard服务框架来使用以下代码。

I would like to use the Springboard services framework to make use of the following code.

SBSLaunchApplicationWithIdentifier(CFSTR("com.apple.preferences"), false);

然而,当我下载头文件并在我的项目中使用它时,它将无法构建。请告诉我如何使这项工作。

However when I download the header files and use it in my project it won't build. Please let me know how to make this work.

推荐答案

您准备使用该方法的具体内容是什么?我的印象是从守护进程启动应用程序?

What exactly are you planning on using that method for? I was under the impression it was for launching an application from a daemon?

还有其他方法可以轻松启动应用程序。我发现最可靠的是使用显示栈来正确启动应用程序。启动应用程序的其他方法往往会在您关闭它并尝试重新启动并崩溃时引起问题。

There are other ways to launch an application quite easily. The most reliable I have found is to use the display stacks to launch the application properly. Other methods of launching the app tend to cause issues when you close it and attempt to relaunch and it crashes.

使用theos,您可以执行以下操作:

Using theos, you could do something like this:

NSMutableArray *displayStacks = nil;

// Display stack names
#define SBWPreActivateDisplayStack        [displayStacks objectAtIndex:0]
#define SBWActiveDisplayStack             [displayStacks objectAtIndex:1]
#define SBWSuspendingDisplayStack         [displayStacks objectAtIndex:2]
#define SBWSuspendedEventOnlyDisplayStack [displayStacks objectAtIndex:3]

// Hook SBDisplayStack to get access to the stacks

%hook SBDisplayStack

-(id)init
{
    %log;
    if ((self = %orig)) 
    {
        NSLog(@"FBAuth: addDisplayStack");
        [displayStacks addObject:self];
    }
    return self;
}

-(void)dealloc
{
    [displayStacks removeObject:self];
    %orig;
}

%end

然后启动应用,执行此操作:

And then to launch the app, do this:

id PreferencesApp = [[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:@"com.apple.preferences"];

[SBWActiveDisplayStack pushDisplay:PreferencesApp];

但是,如果您真的想使用该方法,则需要指定阻止它的错误构建并检查您使用哪个头文件来构建它。您还需要链接到SBS框架。

However, if you really want to use that method, you need to specify what errors are stopping it from building and check which header files you are using to build it with. You also need to link against the SBS framework.

这篇关于如何使用Springboard Services Framework来使用SBSLaunchApplicationWithIdentifier的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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