Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 调试电视分辨率开关_Ios_Objective C_Ipad_Ios Simulator_Sigterm - Fatal编程技术网

Ios 调试电视分辨率开关

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

我想写一个使用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
  {
    // ...
  }
但是,如果我在模拟器中运行此操作并切换电视分辨率(或打开或关闭“TV out”),则不会收到通知,但应用程序会在
sigterm
处终止


有没有办法在模拟器中测试这一点?

有人能解释一下否决票(尤其是不加评论的否决票)吗;我也有同样的问题。但它与您的代码片段无关。