针对错误:
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES
提示错误信息:
2015-12-10 10:41:55.442 MobileLesson[9797:3827595] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES'
*** First throw call stack:
(0x185a5cf48 0x19a60ff80 0x185a5ce90 0x18b06856c 0x18b071b84 0x18b071afc 0x18b0705e4 0x18afeb020 0x18afea350 0x1868fd580 0x18afea1d4 0x18aff7b0c 0x18b43ec7c 0x18b349210 0x18b347328 0x18b2a056c 0x18b2ad4bc 0x18afe1984 0x185a13bd0 0x185a11974 0x185a11da4 0x185940ca0 0x190b7c088 0x18b058ffc 0x1001dda98 0x19ae5e8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
解决办法,重写UIAlertContrller 的shouldAutorotate 方法,
#import <UIKit/UIKit.h>
@interface UIAlertController (Rotation)
- (BOOL)shouldAutorotate;
@end
#import "UIAlertController+Rotation.h"
@implementation UIAlertController (Rotation)
- (BOOL)shouldAutorotate
{
return NO;
}
@end
搞定