Simulate all physical buttons like the pressure on

2020-02-26 10:07发布

问题:

I'm trying to simulate the "home button pressed" on iOS 7 but the previous method used on iOS 6 doesn't work. I speak of course of a jailbroken device.

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

*UPDATE What I really need is a generic method like the old one that let me to simulate the pressure of all physical buttons

回答1:

Try this.

[[%c(SBUIController) sharedInstance]clickedMenuButton];



回答2:

I found some references to homeButtonPress in the header dumps of BiometricKit https://github.com/MP0w/iOS-Headers/blob/6e220684809a8e581357c1622efcc002a1df5014/iOS7/PrivateFrameworks/BiometricKit/BiometricKit.h#L68