这个想法是制作一个应用程序,可以在iOS上的另一个应用程序的后台连续发送“点击屏幕坐标(x,y)”事件。想象一下“Cookie Clicker”作弊。我目前正在协助我的朋友开发他的应用程序,我的工作是尽可能地试图使其出现漏洞。我有一种轻微的感觉,尽可能多地点击他的按钮会导致他的应用程序出现故障,因此我来到这里。
该方法使用KIF以及iOS的后台执行来实现此目的。
该方法使用KIF以及iOS的后台执行来实现此目的。
In one of the classes, the file KIFUITestActor.m has the code:
- (void)tapScreenAtPoint:(CGPoint)screenPoint { [self runBlock:^KIFTestStepResult(NSError **error) { // Try all the windows until we get one back that actually has something in it at the given point UIView *view = nil; for (UIWindow *window in [[[UIApplication sharedApplication] windowsWithKeyWindow] reverseObjectEnumerator]) { CGPoint windowPoint = [window convertPoint:screenPoint fromView:nil]; view = [window hitTest:windowPoint withEvent:nil]; // If we hit the window itself, then skip it. if (view != window && view != nil) { break; } } KIFTestWaitCondition(view, error, @"No view was found at the point %@", NSStringFromCGPoint(screenPoint)); // This is mostly redundant of the test in _accessibilityElementWithLabel: CGPoint viewPoint = [view convertPoint:screenPoint fromView:nil]; [view tapAtPoint:viewPoint]; return KIFTestStepResultSuccess; }]; }
Would this be the code I'm looking for, and how would I implement it in Swift? (Or Objective-C if it makes things easier?)
- Would running the class as a background service achieve the background execution?