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
発熱から iPhone を守る
Search
Mitsuharu Emoto
November 01, 2023
Programming
0
130
発熱から iPhone を守る
モバチキ 〜Mobile Tips 共有会〜 #2
https://cyberagent.connpass.com/event/297940/
Mitsuharu Emoto
November 01, 2023
Tweet
Share
More Decks by Mitsuharu Emoto
See All by Mitsuharu Emoto
React Native updates
mitsuharu
0
4
macOS なしで iOS アプリを開発する(※ただし xxx に限る)
mitsuharu
1
180
メーカー製 SDK は不要!標準フレームワークだけで作るサーマルプリンターの印刷アプリ
mitsuharu
0
17
Bluetooth 制御で業務用サーマルプリンター対応アプリを作ろう
mitsuharu
0
36
iOS デバイスから始める Bluetooth 制御の業務用サーマルプリンター対応アプリの作り方
mitsuharu
0
68
iOS 開発で便利なツールたち
mitsuharu
0
230
「ゆめみ大技林 ’24」の紹介
mitsuharu
0
58
Vanilla JavaScript はマルチプラットフォームの夢を見るか
mitsuharu
0
230
技適警察24時
mitsuharu
0
200
Other Decks in Programming
See All in Programming
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
450
Go の GC の不得意な部分を克服したい
taiyow
2
770
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
42 best practices for Symfony, a decade later
tucksaun
1
180
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
CSC305 Lecture 25
javiergs
PRO
0
130
fs2-io を試してたらバグを見つけて直した話
chencmd
0
220
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Documentation Writing (for coders)
carmenintech
66
4.5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Designing Experiences People Love
moore
138
23k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Into the Great Unknown - MozCon
thekraken
33
1.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Transcript
ൃ͔ΒJ1IPOFΛकΔ ߐຊޫ ϞόνΩʙ.PCJMF5JQTڞ༗ձʙ 1
ࣗݾհ w ͑ͱΈͭΔ w גࣜձࣾΏΊΈJ04ςοΫϦʔυ w ݬͷϞόνΩͷൃදऀͰ͢ w ΤϯδχΞΧϑΣʹ)),#4UVEJPΛݟʹདྷ·ͨ͠ 2
એ w ٕज़ॻయٕॻതʹͯɺٕज़ಉਓࢽʮΏ ΊΈେٕྛ` ʯΛແྉ͠·͢ʂ w ࢲʰ3FEVY4BHBGPS4XJGUʱΛॻ͖·ͨ͠ w ʢʣͷٕज़ॻయΦϑϥΠϯ։࠵
ʢାʣͷϒʔεʢ͞ʣʹډΔͷͰɺݱ ࢀՃ͞ΕΔํ͓ؾܰʹͲ͏ͧ w ΦϯϥΠϯ։࠵Ͱɺిࢠ൛͕͋ΔͷͰੋඇ 3
J1IPOFγϦʔζ͕ൃച͞Ε͕ͨ w J1IPOFγϦʔζ J04Ͱൃ͕ൃੜʂ w "4$**KQɿΞοϓϧɺʮJ1IPOF1SPʯ͕ҟৗൃ͢ΔݪҼJ04 ͷόάͳͲͩͱίϝϯτIUUQTBTDJJKQFMFN w ʮJ1IPOFʯγϦʔζͷʮ༧ΑΓ͘ͳΔʯɺʮJ04ʯͰ
ղফ͢Δͱ"QQMF*5NFEJB/&84IUUQTXXXJUNFEJBDPKQ OFXTBSUJDMFTOFXTIUNM 4
ࠓճ͚ͩ͡Όͳ͍ɺۙͳൃ w ߴෛՙͳॲཧͳͲΛߦ͍ଓ͚ͯɺJ1IPOFͷຊମԹ ͕͋ΔఔΛ͑ΔͱɺߴԹҙͷܯࠂ͕දࣔ͞ΕΔ w ࣌ؒͷ,ࡱӨͰߴԹҙ͕දࣔ͞ΕͨɺͳͲ w ͷهࣄ w ߴԹҙʂɹJ1IPOF͕͘ͳΔݪҼͱରॲ๏
*5NFEJB.PCJMFIUUQTXXXJUNFEJBDPKQ NPCJMFBSUJDMFTOFXTIUNM IUUQTXXXJUNFEJBDPKQNPCJMF BSUJDMFTOFXTIUNM 5
͞Βʹଞࣾ·ͰऔΓ্͛ͯ͘Δ w ઌͷ9JBPNJͷൃදձʹͯɺ4OBQESBHO(FOͱԹൺֱ͞ΕΔ IUUQTUXJUUFSDPNZVLJDDIJ@XPSMETUBUVT 6
ൃ͕ͨΒ͢Өڹ w ຊମͷج൘όοςϦʔʹμϝʔδΛ༩͑Δ w ಛʹϦνϜΠΦϯిԹʹݫ͘͠ɺՐࡂരൃͷՄೳੑ͕͋Δ w ਪԹdˆ༻ԹdˆอԹdˆ w αʔϚϧεϩοτϦϯάͰʢຊମϨϕϧͰʣΫϥογϡ͢Δ w
ྫྷ٫ϑΝϯͳ͍͠ɺਅՆͷ֎Ͱ͑ͳ͍ 㱯✱A㱯 7 †IUUQTDPOTVNFSIVBXFJDPNKQTVQQPSUCBUUFSZDIBSHJOH †
ൃͷղফʹऔΓΉ w ϑϨʔϜϨʔτܭࢉෛՙ͕͍ɺػೳͳॲཧΛߦ͏ w ͱ͍͑ɺҰʹϦονͳදݱॲཧ͕͑ͳ͍ͷͲ͏ͳͷ͔ʁ w ղܾͱ͍͑ʮਪଌ͢ΔͳɺܭଌͤΑʯ w J1IPOFͷൃΛܭଌͯ͠ɺൃঢ়ଶʹԠͯ͡ॲཧΛΓସ͑Δʁ w
ࠓճ͜ͷܭଌΛऔΓѻ͍·͢ 8
J1IPOFͷൃΛௐΔํ๏ w *OTUSVNFOUT w 4ZTUFN5SBDFͰ5IFSNBM4UBUFΛ֬ೝͰ͖Δ w ʢ༨ஊʣ9DPEFਖ਼͘͠ܭଌͰ͖ͳ͍ͷͰɺΛ͍·͠ΐ͏ w ൃঢ়ଶΛ"1*͔Βঢ়ଶΛऔಘɾߪಡ͢Δ w
ݱঢ়̎छྨͷऔಘํ๏͕͋ΓɺͦΕΒΛհ͠·͢ w ʢ༨ஊʣ"1*ΛௐΔͱɺΧϝϥͷ৭Թ8FBUIFS,JUͷؾԹ͕͋Δ 9
1SPDFTT*OGP w ར༻ͷใऔಘ͢Δ"1* w /PUJ fi DBUJPO$FOUFSͰൃঢ়ଶͷมԽΛݕͰ͖Δ NotificationCenter.default.addObserver( self,
selector: #selector(monitorState), name: ProcessInfo.thermalStateDidChangeNotification, object: nil ) 10
5IFSNBM4UBUF nominal 😀 ঢ়ଶਖ਼ৗൣғͰ͢ fair 😅 ঢ়ଶߴΊͰ͢ serious 🥵 ঢ়ଶߴΊͰ͢
critical 🔥 ঢ়ଶγεςϜͷੑೳʹେ͖ͳӨڹΛٴ΅͓ͯ͠ΓɺσόΠεΛ ྫྷ٫͢Δඞཁ͕͋Γ·͢ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOGPVOEBUJPOQSPDFTTJOGPUIFSNBMTUBUF let state = ProcessInfo.processInfo.thermalState ˞ֆจࣈࢲ͕Πϝʔδͨ͠ͷൃঢ়ଶ 11
"7$BQUVSF%FWJDF w ϥΠϒϏϡʔͳͲ"7$IBQUVSF4FTTJPOͰར༻͞ΕΔஔ͔Βऔಘ͢Δ w ੲͳ͕Βͷ,70ͰมԽΛࢹ͢Δ @objc private dynamic var
videoDeviceInput: AVCaptureDeviceInput! … videoDeviceInput = try AVCaptureDeviceInput(device: videoDevice!) observe(\.videoDeviceInput.device.systemPressureState, options:.new){ [weak self] object, change in guard let self, let state = change.newValue else { return } self.monitorSystemPressureState(systemPressureState: state) } 12
4ZTUFN1SFTTVSF4UBUF-FWFM nominal 😀 γεςϜѹྗਖ਼ৗͰ͢ fair 😅 γεςϜѹྗ͕Θ͔ͣʹ্ঢ͍ͯ͠Δ serious 🥵 γεςϜѹྗ͕ඇৗʹߴ͘ͳ͍ͬͯΔ
critical 🔥 γεςϜѹྗ͕ஶ্͘͠ঢ͍ͯ͠Δ shutdown ☠ γεςϜѹྗ͕ݶքΛ͍͑ͯΔͨΊɺΩϟϓ νϟγεςϜγϟοτμϯ͍ͯ͠Δ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOBWGPVOEBUJPOBWDBQUVSFEFWJDFTZTUFNQSFTTVSFTUBUFMFWFM let level = systemPressureState.level ˞ֆจࣈࢲ͕Πϝʔδͨ͠ͷൃঢ়ଶ 13 w ѹྗʢෛՙʣɺԹ ిྗྔͳͲ༷ʑͳ֎෦ཁ Ҽʹࠨӈ͞ΕΔ w ిؾճ࿏ʹ͓͍ͯɺҰൠ తʹʮෛՙʯͱߟ͑ ͯͳ͍Ͱ͢
4ZTUFN1SFTTVSF4UBUF'BDUPST w ཁҼݸผʹऔಘͰ͖Δ w CJUNBTL 0QUJPO4FU Ͱ ఆٛ͞ΕΔͷͰɺෳ߹త ͳཁҼΛऔಘͰ͖Δ w
1SPTTFTT*OGPʹཁҼ ͕ཉ͍͠ʂ // bitmask of values indicating the factors // contributing to the current system pressure level. let factors = systemPressureState.factors if (factors == [.systemTemperature]) { // γεςϜશମͷߴͳෛՙ } if (factors == [.peakPower]) { // γεςϜͷϐʔΫిྗཁ͕݅όοςϦʔͷిྲྀ༰ྔΛա } if (factors == [.depthModuleTemperature]) { // ਂใΛऔಘ͢ΔϞδϡʔϧ͕ߴԹͰಈ࡞ } if (factors == [.cameraTemperature]) { // ΧϝϥϞδϡʔϧ͕ߴԹͰಈ࡞ʢiOS 17 Ҏ্ͷΈʣ } 14 IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOBWGPVOEBUJPO BWDBQUVSFEFWJDFTZTUFNQSFTTVSFTUBUFGBDUPST
ൃঢ়ଶͷςετͲ͏ͬͯʁ w ࣮ػͰൃςετΛΓ͗͢Δ ͱɺϦνϜΠΦϯి͕Β ΜͰɺނো͢Δ w 9DPEF͔Β࣮ػͷൃΛγ ϛϡϨʔτͰ͖Δ w ͨͩ͠ɺ"7$BQUVSF%FWJDFͷ
ൃγϛϡϨʔτະରԠʜ 15
·ͱΊ w ෛՙ͕ߴ͍ΞϓϦΛ࡞Δ߹ɺൃঢ়ଶͷཧ͠·͠ΐ͏ w ൃ͕ݪҼͰΫϥογϡͨ͠߹ɺΫϥογϡϨϙʔτ͕ڍ͕Βͳ͍ ͜ͱ͕͋Γɺ։ൃऀࣄѲݪҼڀ໌͕Ͱ͖ͳ͍ w ετΞͰʮΫϥογϡͨ͠ͷͰ̍Ͱ͢ʯ͕૿͑Δ͔ w ࠓճհͨ͠ίʔυ(JU)VCʹ·ͱΊ͍ͯ·͢
w IUUQTHJUIVCDPNNJUTVIBSV5IFSNBM.POJUPS4BNQMF 16
ʢ͓·͚ʣՃ"1*͔Βͷߟ w J04 WJTJPO04 ͔ΒཁҼʹDBNFSB5FNQFSBUVSF͕Ճ͞Εͨ w "QQMF7JTJPO1SPʹ͚ͨ४උʁͱ༧͍ͯ͠·͢ w ຊମਖ਼໘ͷΧϝϥɺ֎͚ͷόοςϦʔͱཧతʹݯ͕Εͨ w
ൃࣄނ͕ىͬͨ͜Βେʢ௨ৗͰ͕ͩɺಛʹ7JTJPO1SP಄ ʹண͢ΔͷͰʣͳͷͰɺൃରࡦͱͯେʂ w ಄ͷۙ͘ʹݯ͕͋ΔͱମʹӨڹ͋Γͦ͏ͳͷͰҙ͠ͳ͍ͱ 17