← Back to list

Get current iPhone/device model 取得手機型號資訊

(Device model, iPhone model)

Peggy Tsai  in 彼得潘的 Swift iOS / Flutter App 開發教室 · 2021-12-09 03:38 · 100 claps · 2.0 min read
#device-models #iphone-models #uidevice #swift #taiwan
Open on Medium ↗
Wiki topics: 📱 · Mobile Development

Get current iPhone/device model 取得手機型號資訊

(Device model, iPhone model)

想取得前取得手機資訊(手機型號、名稱等)

透過 UIDevice.current 可以取得手機的資訊

詳細UIDevice介紹 https://developer.apple.com/documentation/uikit/uidevice

目前提供model資訊只能取得iPhone資訊

如果想取得手機型號(例如: iPhone 8 Plus) 可以參考本文

參考文獻

[embed]How to determine the current iPhone/device model? Is there a way to get the device model name (iPhone 4S, iPhone 5, iPhone 5S, etc) in Swift? I know there is a property…stackoverflow.com

對UIDevice做擴充函式 (下面git檔案加入專案中即可使用)

[embed]

未來出新手機,在mapToDevice中自己擴充型號

擴充型號方式

下面網址中可查詢新手機型號的Identifier

[embed]Models iOS runs on various different models of devices. This page is used to give an overview of the different model numbers…www.theiphonewiki.com

Generation 中找到新的iPhone型號,以下使用iPhone舉例

identifier中新增case

case “iPhone1,1”: return “iPhone”

case 後面增加 Generation 資訊 return後面填寫 identifier資訊

即可增加新的手機型號資訊


메타데이터
post_id
5cee991ace1e
slug
get-current-iphone-device-model-取得手機型號資訊-5cee991ace1e
url
https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/get-current-iphone-device-model-%E5%8F%96%E5%BE%97%E6%89%8B%E6%A9%9F%E5%9E%8B%E8%99%9F%E8%B3%87%E8%A8%8A-5cee991ace1e
canonical_url
https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/get-current-iphone-device-model-%E5%8F%96%E5%BE%97%E6%89%8B%E6%A9%9F%E5%9E%8B%E8%99%9F%E8%B3%87%E8%A8%8A-5cee991ace1e
author_url
https://medium.com/@peggy-tsai
status
ok
fetched_at
2026-08-18 00:10:00