我想写一个使用extern TV的iPad应用程序。 要检测外部显示器,我使用推荐的代码:
- (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
{
// ...
}
但是,如果我在模拟器中运行并切换电视的分辨率(或打开或关闭“电视输出”),我不获取通知但应用程序终止sigterm
有没有办法在模拟器中测试?