如何使用带有xcode的方案URL启动Siri? [英] How to launch Siri using scheme url with xcode?
问题描述
我需要通过openUrl:
方法启动 Siri (在越狱设备上).
I need to launch Siri (on a jailbroken device) through the openUrl:
method.
例如
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Siri://"]];
推荐答案
Siri似乎没有任何 URL方案,因此我认为您不能以这种方式打开它. Siri也不是普通的 App ,它是SpringBoard使用的库.
There doesn't seem to be any URL Scheme for Siri, so I don't think you can open it that way. Siri is also not a normal App, it's a library that's used by SpringBoard.
无论如何,如果您想以其他方式打开它,我会尝试查看rpetrich的 libActivator 源代码.
Anyway, if you want another way to open it, I would try looking at rpetrich's libActivator source code.
如果您在这里看到,您会看到类似的内容满足您的需求. 虚拟助手是"Siri".
If you look here, you'll see something similar to what you need. The Virtual Assistant is "Siri".
- (BOOL)activateVirtualAssistant{
if ([%c(SBAssistantController) preferenceEnabled]) {
if ([%c(SBAssistantController) shouldEnterAssistant]) {
SBAssistantController *assistant = (SBAssistantController *)[%c(SBAssistantController) sharedInstance];
if (assistant.assistantVisible)
[assistant dismissAssistant];
else {
[(SpringBoard *)UIApp activateAssistantWithOptions:nil withCompletion:nil];
return YES;
}
}
}
return NO;
}
此处,代码调用activateAssistantWithOptions:withCompletion:
,这是 SpringBoard类本身.
Here, the code calls activateAssistantWithOptions:withCompletion:
, which is a method in the SpringBoard class itself.
这种技术当然是基于MobileSubstrate hooking .
This technique, of course, is based on MobileSubstrate hooking.
免责声明:我尚未测试此代码.不过,只是看一下它,这似乎就是您所需要的.
Disclaimer: I have not tested this code. Just looking at it, though, it seems to be what you need.
这不是使用URL方案,但是我确实找到了另一种启动Siri的方式,此答案中所述.
This isn't using URL schemes, but I did figure out a different way to launch Siri, described in this answer.
这篇关于如何使用带有xcode的方案URL启动Siri?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!