iOS - Cydia open命令及其对应的? [英] iOS - Cydia open command and its counterpart?

查看:451
本文介绍了iOS - Cydia open命令及其对应的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个名为 open Cydia 命令行实用程序,它将打开一个iOS应用程序,
附加到SpringBoard。



是否有相应的 close 命令会将正确的信号发送到应用程序的
?它需要发送正确的信号,以便在终止之前进行
必要的清理。 kill 命令无法使用,因为
应用程序无法捕获信号。



I一直在搜索这个特定的命令行工具的高低,但是还有
还没找到它。



谢谢。

解决方案

我不知道任何这样的命令,但你当然可以自己构建一个模拟按钮按下的命令。这应该以正常方式关闭打开的应用程序。这不是一个异常的 kill 。如果该应用程序支持多任务处理,它将转到后台,一路上都有正常的 UIApplicationDelegate 回调。


  1. 构建非图形化iOS应用程序。只需剥离 UIApplicationMain()调出 main.m


  2. 将您的应用程序与GraphicsServices.framework链接。它是一个私有框架,因此在Xcode 构建阶段设置窗口中,您通常选择要链接的框架,您将无法在公共列表中看到它。在文件系统上导航到专用框架文件夹(例如 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1。 sdk / System / Library / PrivateFrameworks )并选择它。


  3. 您需要为GSEvent.h生成标题(和可能是GSWindow.h,它是#includes)。 您可以在这里找到两者的副本。将它们添加到您的项目中,并在 main.m 文件中 #include GSEvent.h


  4. 使用此功能:






< pre class =lang-objc prettyprint-override> #includeGSEvent.h

- (void)simulateHomeButton
{
struct GSEventRecord record ;
memset(& record,0,sizeof(record));
record.type = kGSEventMenuButtonDown;
record.timestamp = GSCurrentEventTimestamp();
GSSendSystemEvent(& record);
record.type = kGSEventMenuButtonUp;
GSSendSystemEvent(& record);
}

此代码应该可用作关闭当前应用的方法(即代码在前台的UIApplication中运行,或者另一个打开的应用程序(就像构建命令行实用程序一样)。



Hattip为这个想法 libActivator


There is a Cydia command line utility called open which will open an iOS application and attach to the SpringBoard.

Is there a corresponding close command which will send the correct signal to the application ? It needs to send the correct signal so that it will do the necessary cleanup before terminating. The kill command cannot be used as the application is not able to catch the signal.

I have been searching high and low for this particular command line tool but yet to find it.

Thank you.

解决方案

I don't know of any such command, but you could certainly build one yourself that simulates a home button press. That should close the open app the normal way. It's not an abnormal kill. If the app supports multitasking, it'll go to the background, with all the normal UIApplicationDelegate callbacks along the way.

  1. Build a non-graphical iOS application. Just strip the UIApplicationMain() call out of main.m

  2. Link your application against GraphicsServices.framework. It's a private framework, so in the Xcode Build Phases settings window, where you normally choose frameworks to link against, you won't see it in the public list. Navigate on the file system to the Private Frameworks folder (e.g. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/PrivateFrameworks) and pick it.

  3. You'll need to generate headers for GSEvent.h (and probably GSWindow.h, which it #includes). Here you can find a copy of both. Add them to your project, and #include GSEvent.h in your main.m file.

  4. Use this function:

#include "GSEvent.h"

- (void)simulateHomeButton
{
   struct GSEventRecord record;
   memset(&record, 0, sizeof(record));
   record.type = kGSEventMenuButtonDown;
   record.timestamp = GSCurrentEventTimestamp();
   GSSendSystemEvent(&record);
   record.type = kGSEventMenuButtonUp;
   GSSendSystemEvent(&record);
}

This code should be usable as a method to close the current app (i.e. the code runs inside the UIApplication that's in the foreground), or another open app (as would be the case for building a command line utility).

Hattip to libActivator for the idea.

这篇关于iOS - Cydia open命令及其对应的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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