3

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 の解像度を切り替える (または「TV 出力」をオンまたはオフに切り替える) と、通知は表示され、アプリケーションは終了しsigtermます。

シミュレーターでこれをテストする方法はありますか?

4

0 に答える 0