diff --git a/Sources/KIF/Additions/UIApplication-KIFAdditions.m b/Sources/KIF/Additions/UIApplication-KIFAdditions.m index cbc3e5fe..a1bdfc56 100644 --- a/Sources/KIF/Additions/UIApplication-KIFAdditions.m +++ b/Sources/KIF/Additions/UIApplication-KIFAdditions.m @@ -178,7 +178,9 @@ - (BOOL)writeScreenshotForLine:(NSUInteger)lineNumber inFile:(NSString *)filenam } return NO; } - + + UIWindow *keyboardWindow = [self keyboardWindow]; + UIGraphicsBeginImageContextWithOptions([[windows objectAtIndex:0] bounds].size, YES, 0); for (UIWindow *window in windows) { //avoid https://github.com/kif-framework/KIF/issues/679 @@ -186,6 +188,12 @@ - (BOOL)writeScreenshotForLine:(NSUInteger)lineNumber inFile:(NSString *)filenam continue; } + if (@available(iOS 17.0, *)) { + if (window == keyboardWindow) { + continue; + } + } + if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) { [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES]; } else {