Is Possible to Simulate Touch Event Using an External Keyboard on iOS Jailbroken

How can I simulate the touch events by IOHIDEvent?

As I mentioned in my answer to your other question today, you might try looking at GSEvent.h from GraphicsServices.framework, or in IOKit.framework.

Here are some good answers on stackoverflow to help you:

iOS Private API: lock device and power off the screen

GSSendEvent - Inject Touch Event iOS

iOS touch event notifications (private API)

Simulate touch on iphone

It's not easy to synthesize a touch event on the iPhone: you have to use undisclosed API, so you have a high probability of breaking on every update of the iOS and getting rejecting from Apple.

Here's a link that demonstrates how to synthesize a touch event on the iPhone:

Here's another question on StackOverflow: How to send a touch event to iPhone OS?

Show iPhone soft keyboard even though a hardware keyboard is connected

Yes. We've done this in a few of our apps for when the user has a Bluetooth scanner "keyboard" paired with the device. What you can do is make sure your textField has an inputAccessoryView and then force the frame of the inputAccessoryView yourself. This will cause the keyboard to display on screen.

We added the following two functions to our AppDelegate. The 'inputAccessoryView' variable is a UIView* we have declared in our app delegate:

//This function responds to all textFieldBegan editing
// we need to add an accessory view and use that to force the keyboards frame
// this way the keyboard appears when the scanner is attached
-(void) textFieldBegan: (NSNotification *) theNotification
{
UITextField *theTextField = [theNotification object];
// NSLog(@"textFieldBegan: %@", theTextField);

if (!inputAccessoryView) {
inputAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, navigationController.view.frame.size.width, 1)];
}

theTextField.inputAccessoryView = inputAccessoryView;

[self performSelector:@selector(forceKeyboard) withObject:nil afterDelay:0];
}

//Change the inputAccessoryView frame - this is correct for portrait, use a different
// frame for landscape
-(void) forceKeyboard
{
inputAccessoryView.superview.frame = CGRectMake(0, 759, 768, 265);
}

Then in our applicationDidFinishLaunching we added this notification observer so we would get an event anytime a text field began editing

    //Setup the textFieldNotifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldBegan:) name:UITextFieldTextDidBeginEditingNotification object:nil];

Hope that helps!

iOS - Trigger click events outside of the app - like in app drawer

I have managed to do this using Appium java API. First launch a dummy app, then call driver.back() and from there, you will have full control



Related Topics



Leave a reply



Submit