iOS9.1中的UIWindow删除错误

iOS9.1中的UIWindow删除错误,ios,uiwindow,ios9.1,Ios,Uiwindow,Ios9.1,在iOS9.1中,当我通过removeFromSuperView删除自定义UIWindow并设置为nil时,它不会自动消失,直到单击该窗口。并显示错误 \u UIApplicationHandleEventFromQueueEvent中出现意外的nil窗口, _WindowsServerHitTestWindow:(空) 在iOS9及更低版本时,它将正常工作 UIWindow *window = [target associatedValueForKey:lock_window]; if (wi

在iOS9.1中,当我通过removeFromSuperView删除自定义UIWindow并设置为nil时,它不会自动消失,直到单击该窗口。并显示错误

\u UIApplicationHandleEventFromQueueEvent中出现意外的nil窗口, _WindowsServerHitTestWindow:(空)

在iOS9及更低版本时,它将正常工作

UIWindow *window = [target associatedValueForKey:lock_window];
if (window) [window removeFromSuperview];
[target associateValue:nil withKey:lock_window];

我已经用代码解决了这个问题

UIWindow *window = [target associatedValueForKey:lock_window];
if (window) [window removeFromSuperview];
window.hidden = YES;
[target associateValue:nil withKey:lock_window];
-(void)makeKeyAndVisible方法注释为

方便。大多数应用程序调用它来显示主窗口,并将其设置为关键点。否则,请使用视图隐藏属性