Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iOSの画面の状態のアレコレを調査してみた
Search
Ryu-nakayama
September 19, 2025
Programming
95
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
iOSの画面の状態のアレコレを調査してみた
mobile.stmn #13の登壇資料です
Ryu-nakayama
September 19, 2025
More Decks by Ryu-nakayama
See All by Ryu-nakayama
iOS機能開発のAI環境と起きた変化
ryunakayama
0
210
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
420
iOSアプリでフロントエンドと仲良くする
ryunakayama
0
150
「ジェン文字」使ってますか?
ryunakayama
0
74
Health Kit × Foundation Models でAIコーチを作ってみた
ryunakayama
0
350
作文ツール(Writing Tools)をアプリから制御する
ryunakayama
0
59
iOSアプリで測る!名古屋駅までの 方向と距離
ryunakayama
0
310
「ジェン文字」をアプリ内で使ってみよう
ryunakayama
0
200
SwiftDataと連携したWidgetを作ってみた
ryunakayama
1
220
Other Decks in Programming
See All in Programming
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
190
Webフレームワークの ベンチマークについて
yusukebe
0
180
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
11
6.1k
JavaDoc 再入門
nagise
1
380
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
370
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
270
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.5k
A2UI という光を覗いてみる
satohjohn
1
150
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
2
250
OSもどきOS
arkw
0
580
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
750
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
200
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
330
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
210
Producing Creativity
orderedlist
PRO
348
40k
Code Review Best Practice
trishagee
74
20k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
630
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
170
Transcript
iOSの画面の状態のアレコレを調査 してみた iOSアプリ開発グループ 機能開発チーム 中山 龍 2025年08月29日
2 中山 龍 (なかやま りゅう) • 株式会社kubell ◦ 新卒3年目のiOSエンジニア(23) ◦
「Chatwork」アプリの開発を担当 ◦ 機能開発チーム(愛称: Ciel) チームリーダー • 愛知県在住 ◦ 自己紹介 @ryu_develop 来月のiOSDCでブースを出すので ぜひお越しください
ARグラス買いました!
4 最近、ARグラス買いました XREAL SHOP より引用 前々から気になっていた『XREAL One Pro』を購入 してみました! iPhone・iPad・Mac・PS5などに繋いでどこでも大画
面を楽しんでいます オフィスに行った際にこれをつけて仕事をしていたら 「めっちゃ目立ってる人いた」って言われました
5 最近、ARグラス買いました XREAL SHOP より引用 XREAL One Proを使ってiPhoneのアプリを使用して いると稀に「このアプリは録画を禁止しています」 のように、使えないアプリがあることに気がつきま
した なので、「録画や画面ミラーリングが現在されてい る」など、画面の状態をアプリ側の処理で扱う方法 について調査してみました
01 | スクリーンショット
スクリーンショットを検知する UIApplication.userDidTakeScreenshotNotification という NSNotification.Name で検知することができる スクリーンショットを撮影
スクリーンショットを検知する(サンプル) NotificationCenter.default.addObserver( forName: UIApplication.userDidTakeScreenshotNotification, object: nil, queue: .main ) {
_ in // イベント発生時の処理 } イベント購読のサンプルコード
02 | 画面録画
画面録画を検知する UIScreen.capturedDidChangeNotification という NSNotification.Name で録画状態変更のイベントを検知することができる UIScreen.main.isCaptured で現在録画中かどうかを判定できる 録画 停止
画面録画を検知する(サンプル) NotificationCenter.default.addObserver( forName: UIScreen.capturedDidChangeNotification, object: nil, queue: .main ) {
_ in if UIScreen.main.isCaptured { // 録画が開始された際の処理 } else { // 録画が停止された際の処理 } } イベント購読のサンプルコード
03 | 外部ディスプレイ
外部ディスプレイの使用を検知する UIScreen.didConnectNotification という NSNotification.Name でスクリーンへの接続を検知することができる UIScreen.didDisconnectNotification という NSNotification.Name でスクリーンの切断を検知することができる 接続
切断
外部ディスプレイの使用を検知する UIScreen.didConnectNotification という NSNotification.Name でスクリーンへの接続を検知することができる UIScreen.didDisconnectNotification という NSNotification.Name でスクリーンの切断を検知することができる 接続
切断 ⚠ この方法は現在、非推奨となっている
外部ディスプレイの使用を検知する(推奨) scene(_:willConnectTo:options:) 接続 UIScene.willConnectNotification 切断 sceneDidDisconnect(_:) UIScene.didDisconnectNotification sceneのdelegateメソッドかUIScene由来のものが推奨されている
画面録画の検知と 外部ディスプレイについて
画面録画を検知している状態で外部ディスプレイを接続すると... 画面録画をしていないにも関わらず、ディスプレイを繋い だだけで録画中の判定になってしまう... → capturedDidChangeNotification や isCaptured で扱う ことができるCaptureというのは、画面録画だけでなく、外 部ディスプレイへの投影やAirPlayも含まれてしまうとのこ
と 参考 ・capturedDidChangeNotification ・isCaptured
画面録画を検知している状態で外部ディスプレイを接続すると... 画面録画をしていないにも関わらず、ディスプレイを繋い だだけで録画中の判定になってしまう... → capturedDidChangeNotification や isCaptured で扱う ことができるCaptureというのは、画面録画だけでなく、ミ ラーリングやAirPlayも含まれてしまうとのこと
参考 ・capturedDidChangeNotification ・isCaptured AR グラスで使えないアプリはこれが原因っぽい!! Captureの状態と画面接続の状態と組み合わせて判定しても、画面録画をNGにし つつ、ディスプレイ接続のみはOKというのはできない気がしました (ディスプレイ接続中の画面録画を検知できない) 何かいい方法やAPIをご存じの方がいたら教えてください
まとめ
まとめ 検知すること 方法 スクリーンショット UIApplication.userDidTakeScreenshotNotification 画面録画 (ディスプレイ接続などを含む) UIScreen.capturedDidChangeNotification (録画状態の変化) UIScreen.main.isCaptured
(録画状態の判定) 外部ディスプレイの使用(接続) scene(_:willConnectTo:options:) UIScreen.didDisconnectNotification 外部ディスプレイの使用(切断) sceneDidDisconnect(_:) UIScene.willDisconnectNotification • ARグラス接続状態でアプリが利用できない場合は、画面録画の検知に用いる Captureにディスプレイ接続も含まれていることでARグラス接続を画面録画 と認識して使用NGの処理をしてしまっているためだと考えられる • 画面録画とディスプレイ接続を区別する(画面録画は完全にNGにしつつ、ディ スプレイ接続をOKにする)のは難しそうだということがわかった
働くをもっと楽しく、創造的に