我正在尝试模拟iOS 7上的"按下主页按钮",但是以前在iOS 6上使用的方法不起作用。我说的当然是越狱设备。
#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);
}
*更新我真正需要的是一种像旧方法一样的通用方法,可以让我模拟所有物理按钮的压力
试试这个。
[[%c(SBUIController) sharedInstance]clickedMenuButton];
我在 BiometricKit 的标头转储中找到了一些对homeButtonPress
的引用https://github.com/MP0w/iOS-Headers/blob/6e220684809a8e581357c1622efcc002a1df5014/iOS7/PrivateFrameworks/BiometricKit/BiometricKit.h#L68