gpt4 book ai didi

ios - _viewControllerForSupportedInterfaceOrientationsWithDismissCheck 无法识别的选择器

转载 作者:可可西里 更新时间:2023-11-01 05:28:42 26 4
gpt4 key购买 nike

我在最终 View Controller (portait)上显示了一个图像,此时所有内容都在屏幕上,如果我将设备横向和横向旋转,它仍然可以,但是;

如果我随后使用 SLComposeViewController(用于 Twitter 发布),一旦我取消它(无论是取消还是发布内容)然后旋转手机横向,应用程序就会崩溃并出现以下错误;

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIAppearanceCustomizableClassInfo _viewControllerForSupportedInterfaceOrientationsWithDismissCheck:]: unrecognized selector sent to instance 0x1b9eefd0'

虽然我不使用横屏模式,但当我将它转为横屏模式时,应用程序确实会转动,但这不是主要问题,问题是应用程序崩溃。

虽然我知道如果用户在发布到 Twitter 后不打开手机会很好,但这并不理想,我宁愿修复一些问题,因为我相信你同意。

关于方向支持,AppDelegate.m有这个;

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskLandscape|UIInterfaceOrientationMaskPortrait |UIInterfaceOrientationMaskPortraitUpsideDown;
}

崩溃的 Controller 有这个;

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
NSString *viewControllerClassName = [NSString stringWithUTF8String:object_getClassName(window.rootViewController)];
if ([viewControllerClassName isEqualToString:@"_UIAlertShimPresentingViewController"]) {
return UIInterfaceOrientationMaskPortrait;
}
else {
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
}

-(BOOL)shouldAutorotate{
return NO;
}

最佳答案

当您从 UIActionSheet 显示模态视图 Controller 并关闭模态视图 Controller 并旋转屏幕时,我在 iOS 8 中也看到了类似的崩溃。

我认为它与呈现模态视图 Controller 有关。上述延迟显示模态视图 Controller 的修复确实有效,

不是从 actionSheet:clickedButtonAtIndex 调用当前模态视图 Controller :UIActionSheet 的委托(delegate)方法,而是从“actionSheet didDismissWithButtonIndex:”调用并为我工作。

关于ios - _viewControllerForSupportedInterfaceOrientationsWithDismissCheck 无法识别的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26100437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com