cysp / IOHIDPlayground

Mozilla Public License 2.0
5 stars 1 forks source link

Working on simulator iOS 7 but not on device #1

Open NgNivida opened 10 years ago

NgNivida commented 10 years ago

Thanks for the repository.

I have simulated the touch event on a UIButton. Its working fine on simulator but not on device i.e iPhone 4s iOS 7.

Following is the code:-

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 60)];
[button setTitle:@"Click me" forState:UIControlStateNormal];
[button setBackgroundColor:[UIColor greenColor]];
[button addTarget:self action:@selector(buttonTapped)  forControlEvents:UIControlEventTouchUpInside];

[viewController.view addSubview:button];

self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];

STIOHIDDigitizer * const digitizer = [[STIOHIDDigitizer alloc] init];

STIOHIDDigitizerTouch * __block touch1 = nil;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    touch1 = [digitizer touchAtPosition:(CGPoint){ 120, 120 }];        
});
ngtechsahil commented 10 years ago

Facing exactly the same problem. Working fine on simulator but nothing is happening on my actual device iPhone4S iOS 7.1

ngtechsahil commented 10 years ago

Do I need to import STTouchDisplay classes in the STIOHIDPlayground project to make it work? I haven't included that yet.

cysp commented 10 years ago

That sucks. :-(

cysp commented 10 years ago

Looks like it doesn't work on my 7.1 devices either. And of course I don't have any devices running an earlier OS at hand to verify my memory that it used to work.

ngtechsahil commented 10 years ago

Does this work on non-jailbroken devices or just jailbroken ones?

cysp commented 10 years ago

I'm like 60% sure that it used to work on non-jailbroken devices but it clearly doesn't work with the current version of iOS.

NgNivida commented 10 years ago

I think Apple has made some changes in frameworks for iOS 7.1 for touch events. Is that possible that you can compile the STIOHID library's original code in your latest Xcode (i.e 5.1) and push the code.

Thanks in advance.

kazzmir commented 6 years ago

I am trying to do something similar to IOHIDPlayground, but it seems that sending events via IOHIDEventSystemClientDispatchEvent has no affect. I have experimented with creating events in a plethora of ways to no avail. I think that testmanagerd, the daemon XCTest uses to send events, internally uses the same IOHID* api and it can successfully be used to simulate touch events (see the WebDriverAgent project from facebook). Perhaps there is some unique attribute that must be applied to events for the IOHID subsystem to properly handle, otherwise they get silently tossed out.

I am testing on a 10.2.6 iphone6.