Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
iOSの画面の状態のアレコレを調査してみた
Search
Ryu-nakayama
September 19, 2025
Programming
130
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
AIに「任せない」という選択
ryunakayama
0
79
iOS機能開発のAI環境と起きた変化
ryunakayama
0
270
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
450
iOSアプリでフロントエンドと仲良くする
ryunakayama
0
180
「ジェン文字」使ってますか?
ryunakayama
0
99
Health Kit × Foundation Models でAIコーチを作ってみた
ryunakayama
0
380
作文ツール(Writing Tools)をアプリから制御する
ryunakayama
0
87
iOSアプリで測る!名古屋駅までの 方向と距離
ryunakayama
0
340
「ジェン文字」をアプリ内で使ってみよう
ryunakayama
0
230
Other Decks in Programming
See All in Programming
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
140
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
340
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
680
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
330
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
460
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
340
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2k
AWSに止められる覚悟してますか?
morizo_1984
2
480
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
400
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
280
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
440
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
440
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
890
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
510
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
410
Code Reviewing Like a Champion
maltzj
528
40k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Designing for Timeless Needs
cassininazir
1
510
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にする)のは難しそうだということがわかった
働くをもっと楽しく、創造的に