Ios 调试电视分辨率开关
我想写一个使用extern TV的iPad应用程序。 要检测外部显示,我使用建议的代码:Ios 调试电视分辨率开关,ios,objective-c,ipad,ios-simulator,sigterm,Ios,Objective C,Ipad,Ios Simulator,Sigterm,我想写一个使用extern TV的iPad应用程序。 要检测外部显示,我使用建议的代码: - (void)viewDidLoad { [super viewDidLoad]; // ... [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidChange:) name:UIScreenDidConnectNotification objec
- (void)viewDidLoad
{
[super viewDidLoad];
// ...
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidChange:) name:UIScreenDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidChange:) name:UIScreenDidDisconnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidChange:) name:UIScreenModeDidChangeNotification object:nil];
//...
}
// ...
- (void)screenDidChange:(NSNotification *)notification
{
// ...
}
但是,如果我在模拟器中运行此操作并切换电视分辨率(或打开或关闭“TV out”),则不会收到通知,但应用程序会在sigterm
处终止
有没有办法在模拟器中测试这一点?有人能解释一下否决票(尤其是不加评论的否决票)吗;我也有同样的问题。但它与您的代码片段无关。