Skip to content

Commit

Permalink
Merge pull request #1129 from briannewberry/master
Browse files Browse the repository at this point in the history
Fix bug when acknowledging system alerts in Xcode 11.1
  • Loading branch information
justinseanmartin authored Oct 24, 2019
2 parents 4962c6d + a8ae442 commit 54c099f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Classes/UIAutomationHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ - (UIAAlert *)currentSystemAlert
if ([alert isKindOfClass:[self nilElementClass]]) {
// application.alert returns UIAElementNil on iOS 13.1
// Instead find the alert by looking for the alert's window and getting the UIAAlert off of it
alert = (UIAAlert *)[[[[[application windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIAElement *_Nullable evaluatedObject, NSDictionary<NSString *, id> *_Nullable bindings) {
UIAElement *foundElement = (UIAElement *)[[[application windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIAElement *_Nullable evaluatedObject, NSDictionary<NSString *, id> *_Nullable bindings) {
return [[evaluatedObject valueForKey:@"type"] isEqualToString:@"SBAlertItemWindow"];
}]] firstObject] elements] firstObject];
}]] firstObject];
alert = (UIAAlert *) [[foundElement.elements filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIAElement *_Nullable evaluatedObject, NSDictionary<NSString *, id> *_Nullable bindings) {
return [[evaluatedObject valueForKey:@"type"] isEqualToString:@"_UIAlertControllerView"];
}]] firstObject];
}
#endif

Expand Down

0 comments on commit 54c099f

Please sign in to comment.