How to launch Siri using scheme url with xcode?

点点圈 提交于 2019-12-13 08:26:15

问题


I need to launch Siri (on a jailbroken device) through the openUrl: method.

For example

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Siri://"]];

回答1:


This isn't possible. Also, Xcode is an IDE - a code editor. It's not a language or a platform.




回答2:


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.

Anyway, if you want another way to open it, I would try looking at rpetrich's libActivator source code.

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;
}

Here, the code calls activateAssistantWithOptions:withCompletion:, which is a method in the SpringBoard class itself.

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.


Update:

This isn't using URL schemes, but I did figure out a different way to launch Siri, described in this answer.




回答3:


There's no URL schema for Siri and there's no integration available at this time - there may be integration coming in iOS 7 but at this stage there is no way to perform this function.



来源:https://stackoverflow.com/questions/15800863/how-to-launch-siri-using-scheme-url-with-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!