Before iOS 12.2 we used the following code to implement our own handling for a UIDropInteraction. However, this functionality is broken on iOS 12.2, we no longer can find a view (or subview) of wkwebview where we can add our own UIDropInteraction.
UIView *dropInteractionContainingView = nil;
UIDropInteraction *defaultDropInteractionToRemove = nil;
for (UIView *subview in self.webview.scrollView.subviews) {
for (id<UIInteraction> interaction in subview.interactions) {
if ([interaction isKindOfClass:[UIDropInteraction class]]) {
dropInteractionContainingView = subview;
defaultDropInteractionToRemove = interaction;
break;
}
}
}
//on iOS 12.2 these two variables are always nil.
if (dropInteractionContainingView != nil && defaultDropInteractionToRemove != nil) {
//Now we replace the existing unwanted uidropinteraction with our own, custom implementation.
UIDropInteraction *customDropInteraction = [[UIDropInteraction alloc] initWithDelegate:self];
[dropInteractionContainingView removeInteraction:defaultDropInteractionToRemove];
[dropInteractionContainingView addInteraction:customDropInteraction];
}
Any ideas how to fix this in iOS 12.2?